2021-03-26

  • 嵌入式C语言启动工程

  • 启动汇编文件

.global _start
.global main

_start:
    bl main
  • main文件

#include "inc/main.h"
#include "inc/fun.h"

int main()
{
	int a = 0;
	int b = 2;
	fun(a,b);
	return 1;
}
  • fun文件

    #include "fun.h"
    
    void fun(int a,int b)
    {
    	int c= a + b;
    }

     

  • Makefile

    TARGET   := demo.bin
    BUILD    := demo
    
    ENV      ?= RAM
    
    COBJS    += start.o
    COBJS    += main.o
    COBJS    += fun.o
    
    CROSS_COMPILE := arm-none-eabi-
    
    CC       := $(CROSS_COMPILE)gcc
    LD       := $(CROSS_COMPILE)ld
    OBJCOPY  := $(CROSS_COMPILE)objcopy
    
    CFLAGS   += -Wall
    CFLAGS   += -I./inc
    
    LDFLAGS  += -T ld/mem.ld
    LDFLAGS  += -T ld/sections.ld
    
    #ifeq ($(ENV),RAM)
    #LDFLAGS  += -Ttext=0x20000000
    #else
    #LDFLAGS  += -Ttext=0x0
    #endif
    
    all:$(TARGET)
    ifeq ($(ENV),RAM)
    $(TARGET):$(BUILD)
    	$(OBJCOPY) -O binary $^ $@
    else
    $(TARGET):$(BUILD)
    	$(OBJCOPY) -O binary $^ $@
    endif
    $(BUILD):$(COBJS)
    	$(LD) $(LDFLAGS) -o $@ $^
    
    %.o:%.c
    	$(CC) $(CFLAGS) -c -o $@ $^
    %.o:%.S
    	$(CC) $(CFLAGS) -c -o $@ $^
    
    clean:
    	rm -f $(TARGET) $(BUILD) *.o

     

  • 链接脚本mem.ld

    /*
     * Memory Spaces Definitions.
     *
     * Need modifying for a specific board. 
     *   FLASH.ORIGIN: starting address of flash
     *   FLASH.LENGTH: length of flash
     *   RAM.ORIGIN: starting address of RAM bank 0
     *   RAM.LENGTH: length of RAM bank 0
     *
     * The values below can be addressed in further linker scripts
     * using functions like 'ORIGIN(RAM)' or 'LENGTH(RAM)'.
     */
    
    MEMORY
    {
      FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 8K
      SRAM_DUMMY (xrw) : ORIGIN = 0x1FFE0000, LENGTH = 128K
      DRAM_DUMMY (xrw) : ORIGIN = 0x20000000, LENGTH = 256K
      /* SRAM=SRAM_DUMMY+DRAM_DUMMY */      
      SRAM (xrw) : ORIGIN = 0x1FFE0000, LENGTH = 384K
      DRAM (xrw) : ORIGIN = 0x20000000, LENGTH = 0K
      SDRAM (xrw) : ORIGIN = 0x30000000, LENGTH = 2M 
    /*  SDRAM (xrw) : ORIGIN = 0x20000000, LENGTH = 8M   change the size of SDRAM from 2MB to 8MB*/
     
    }

     

  • 链接脚本sections.ld

    /*
     * Default linker script for Cortex-M (it includes specifics for STM32F[34]xx).
     * 
     * To make use of the multi-region initialisations, define
     * OS_INCLUDE_STARTUP_INIT_MULTIPLE_RAM_SECTIONS for the _startup.c file.
     */
    
    __sram_start = ORIGIN(SRAM);
    __sram_end = ORIGIN(SRAM) + LENGTH(SRAM);
    __sdram_start = ORIGIN(SDRAM);
    __sdram_end = ORIGIN(SDRAM) + LENGTH(SDRAM);
    /*__l2_heap_size = __sdram_end - __l2_heap_start;*/
    
    /*
     * The '__stack' definition is required by crt0, do not remove it.
    */
    __stack = ORIGIN(SRAM) + LENGTH(SRAM) - 16;
    _estack = __stack; 	/* STM specific definition */
    _Minimum_Stack_Size = 2048 ;
    _Minimum_text_sec_Size = LENGTH(SRAM_DUMMY);
    ASSERT(ORIGIN(SRAM_DUMMY) == ORIGIN(SRAM), "SRAM START ADDR ERROR")
    ASSERT((LENGTH(SRAM_DUMMY)+LENGTH(DRAM_DUMMY)) == LENGTH(SRAM), "SRAM LENGTH ERROR");
    ASSERT((ORIGIN(SRAM_DUMMY)+LENGTH(SRAM_DUMMY)) == ORIGIN(DRAM_DUMMY), "SRAM_DUMMY LENGTH ERROR")
    __Main_Stack_Size = _Minimum_Stack_Size ;
    
    
    /*
     * Default heap definitions.
     * The heap start immediately after the last statically allocated 
     * .sbss/.noinit section, and extends up to the main stack limit.
    
    PROVIDE ( _Heap_Begin = _end_noinit ) ;
    PROVIDE ( _Heap_Limit = __sram_end ) ;
    ASSERT (_Heap_Begin < _Heap_Limit, "no heap memory available");
     */
    /* support for cm_backtrace*/
    _sstack = ORIGIN(DRAM);        /*stack start address, we use static stack in bss section.*/
    _estack = __stack;             /*stack end address, NOTICE: _estack was defined up*/
    _stext = __sram_start;         /*text start address*/
    
    /* 
     * The entry point is informative, for debuggers and simulators,
     * since the Cortex-M vector points to it anyway.
     */
    ENTRY(_start)
    
    /* Sections Definitions */
    SECTIONS
    {
        .l1_text : ALIGN(4)
        {
            FILL(0xFF)
            start.o
            main.o
        } >SRAM
       
        .rodata : ALIGN(4)
        {
           *(.rodata)
        } >SRAM
    
        .data : ALIGN(4)
        {
            *(.data)
        } >SRAM
    
        .bss : ALIGN(4)
        {
            *(.bss)
        } >SRAM
    
        .l2_text : ALIGN(4)
        {
            fun.o
        } >SDRAM AT>SRAM
    
    }
    

     

2021-03-26 20:54:33,596 - Model - INFO - Epoch 1 (1/200): 2021-03-26 20:57:40,380 - Model - INFO - Train Instance Accuracy: 0.571037 2021-03-26 20:58:16,623 - Model - INFO - Test Instance Accuracy: 0.718528, Class Accuracy: 0.627357 2021-03-26 20:58:16,623 - Model - INFO - Best Instance Accuracy: 0.718528, Class Accuracy: 0.627357 2021-03-26 20:58:16,623 - Model - INFO - Save model... 2021-03-26 20:58:16,623 - Model - INFO - Saving at log/classification/pointnet2_msg_normals/checkpoints/best_model.pth 2021-03-26 20:58:16,698 - Model - INFO - Epoch 2 (2/200): 2021-03-26 21:01:26,685 - Model - INFO - Train Instance Accuracy: 0.727947 2021-03-26 21:02:03,642 - Model - INFO - Test Instance Accuracy: 0.790858, Class Accuracy: 0.702316 2021-03-26 21:02:03,642 - Model - INFO - Best Instance Accuracy: 0.790858, Class Accuracy: 0.702316 2021-03-26 21:02:03,642 - Model - INFO - Save model... 2021-03-26 21:02:03,643 - Model - INFO - Saving at log/classification/pointnet2_msg_normals/checkpoints/best_model.pth 2021-03-26 21:02:03,746 - Model - INFO - Epoch 3 (3/200): 2021-03-26 21:05:15,349 - Model - INFO - Train Instance Accuracy: 0.781606 2021-03-26 21:05:51,538 - Model - INFO - Test Instance Accuracy: 0.803641, Class Accuracy: 0.738575 2021-03-26 21:05:51,538 - Model - INFO - Best Instance Accuracy: 0.803641, Class Accuracy: 0.738575 2021-03-26 21:05:51,539 - Model - INFO - Save model... 2021-03-26 21:05:51,539 - Model - INFO - Saving at log/classification/pointnet2_msg_normals/checkpoints/best_model.pth 我有类似于这样的一段txt文件,请你帮我写一段代码来可视化这些训练结果
02-06
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值