keil MDK error: L6236E: No section matches selector - no section 错误

  今天板子刚到,下载完MDK就迫不及待的开始解解痒,然而小经波折后将MDK配置好之后,新建的第一个工程就报错了。

  .\Objects\cse.sct(7): error: L6236E: No section matches selector - no section to be FIRST/LAST.

  网上查了一下说什么启动文件没添加,可是他们都没说在哪添加启动文件,我第一次搞这个我也不知道。

 

  并且我在中文博客里发现所有的博主答案大部分都一样(不信你可以自己去搜一下这个问题),却都装的是自己写的,这一点我感觉很伤心。

 

  这时我在stackoverflow里搜到了这个问题。

 

  题主遇到的问题和我遇到的一样,然后下边有答主这样说:

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------  

There is no 'FIRST' object in your source code. Your scatter file likely looks something like:

LR_IROM1 0x08000000 0x00040000  {    ; load region size_region
  ER_IROM1 0x08000000 0x00040000  {  ; load address = execution address
   *.o (RESET, +First)
   *(InRoot$$Sections)
   .ANY (+RO)
  }
  RW_IRAM1 0x20000000 0x0000A000  {  ; RW data
   .ANY (+RW +ZI)
  }

  

  

The _FIRST object that the linker wants to put into the image is the area called RESET. You do not have a RESET region in your code. Add something along the lines of

 

  
AREA    RESET, DATA, READONLY

  

 

  to your assembly file where you want execution to begin.

 

  Create a project with the startup file and look for the AREA RESET ..... declaration and copy that.

 

  For Cortex it looks like:

 

   AREA    RESET, DATA, READONLY
                EXPORT  __Vectors
                EXPORT  __Vectors_End
                EXPORT  __Vectors_Size

__Vectors       DCD     __initial_sp               ; Top of Stack
                DCD     Reset_Handler              ; Reset Handler
                DCD     NMI_Handler                ; NMI Handler
                DCD     HardFault_Handler          ; Hard Fault Handler
                DCD     MemManage_Handler          ; MPU Fault Handler
                DCD     BusFault_Handler           ; Bus Fault Handler
                DCD     UsageFault_Handler         ; Usage Fault Handler
                DCD     0     

 

  

 

  Each of those handlers needs to be declared, but you can just add the stack pointer and reset handler to get started.

 

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------   

我是看到这一段代码在startup里边,把这个模块一添加,咦,好了。

 

你可能感兴趣的:(keil MDK error: L6236E: No section matches selector - no section 错误)