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

Hello World Assembly

I want to simulate the below ARM assembly program on uvision3.

AREA HelloW, CODE, READONLY
SWI_WriteC EQU &0
SWI_Exit EQU &11

ENTRY
START ADR r1,TEXT
LOOP  LDRB r0,[r1],#1
          CMP r0,#0
          SWINE SWI_WriteC
          BNE LOOP
          SWI SWI_Exit
TEXT  = "Hello,World!",&0a,&0d,0
          END

The target is LPC2129 but i just want to run it on the simulator. The problem is when i use the default startup.s file, i get the following error on build:
Build target 'Target 1'
linking...
HelloWorld.axf: Warning: L6665W: Neither Lib$$Request$$armlib Lib$$Request$$cpplib defined, not searching ARM libraries.
HelloWorld.axf: Error: L6218E: Undefined symbol __main (referred from startup.o).
HelloWorld.axf: Error: L6218E: Undefined symbol __use_two_region_memory (referred from startup.o).
Target not created

If i try to build the source without the startup, i get the following error:
Build target 'Target 1'
assembling Main.S...
linking...
HelloWorld.sct(7): error: L6236E: No section matches selector - no section to be FIRST/LAST.
"HelloWorld.axf" - 1 Error(s), 0 Warning(s).

How do i go about rectifiying this? Should i include the startup file eventhough i only want to simulate the code on KEIL ?

Parents
  • "HelloWorld.axf: Error: L6218E: Undefined symbol __main (referred from startup.o)"

    The default startup.s file is for use with 'C' projects; so it expects you to provide a 'C' program to go with it - which must, of course, have a main() function!

    And it will, of course, want to include all the 'C' runtime support libraries.

Reply
  • "HelloWorld.axf: Error: L6218E: Undefined symbol __main (referred from startup.o)"

    The default startup.s file is for use with 'C' projects; so it expects you to provide a 'C' program to go with it - which must, of course, have a main() function!

    And it will, of course, want to include all the 'C' runtime support libraries.

Children
  • No, I do not think that the startup file is needed. But I think you need to modify your assembler file so that it says AREA RESET instead of AREA HelloW.

    Or switch to a manual scatter file, where you change the line:

    *.o (RESET, +First)
    

    into

    *.o (HelloW, +First)
    

    After all, if you run without the startup file, you need to kill the error message:

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

    And the solution is to make sure that your source do contain a symbol that matches the +First rule in the scatter file.