This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Getting error on building

Hi friends,

I am a beginner. I typed a program and after translating i get no error. But i get an error as shown below, while building hex file for that program.

The error is

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

  • I am a beginner

    A beginner at what, exactly?

    Do you have experience with programming in other contexts?

    If you have no experience with 'C', it is probably best to start by learning the language on a PC - that way, you can concentrate on learning the language, without all the added complications of embedded microcontrollers!

    Perhaps start here:

    http://www.keil.com/books/

    http://www2.keil.com/mdk5/learn

    • Thank u for ur support #AndyNeil. I know only C program

      But how can i get rid of that error

      • A good start is always to put the error into your favourite internet search engine; eg,

        https://community.arm.com/developer/tools-software/tools/f/keil-forum/29461/error-l6236e-no-section-matches-selector---no-section-to-be-first-last

        I typed a program

        As well as the 'C' source code, you also need to have the rest of the project set up correctly.

        Rather than just typing from scratch, it's probably easiest to work through an example:

        http://www2.keil.com/mdk5/learn

        http://www.keil.com/books/

        http://www.keil.com/support/man/docs/uv4/uv4_examples.htm

        • Hi CKT_lover,

          Welcome to the world of Arm devices.

          For Posterity, You can read more about this error in  "4.2 List of the armlink error and warning messages" of this guide:

          http://www.keil.com/support/man/docs/armerr/armerr_dom1365073159742.htm

          "The scatter file specifies a section to be +FIRST or +LAST, but that section does not exist, or has been removed by the linker because it believes it to be unused. Use the linker option --info unused to reveal which objects are removed from your project. Example:"

          (Aside - think of a scatterfile sort of like a "linker file" http://www.keil.com/support/man/docs/armlink/armlink_pge1362075656353.htm )

          The Keil tools create a scatterfile for you, so you don't have to worry about it. The default scatterfile wants to put the Reset Vector (and by extension the rest of the vector table) first in the ROM memory, because that is just what you do for Arm devices.

          If the linker can't find the symbol marked as +FIRST anywhere in your project, you get this error. 

          • Make sure to check out the videos here too http://www2.keil.com/video

            Rather than make an example from scratch, maybe use the Keil Pack Installer and load a premade example. It will make more sense how things fit together. 

            http://www2.keil.com/mdk5/packinstaller/

            • Oh,God! l am also a beginner at ARM  programming  and  I can't compile a simple assembly project getting this error too!But finally l found the solution:

              R_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.

              Hope it helps as well!

              0