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
  • The warning that you don't need a library is just that - a warning.

    But another thing. Your assembler file specifies:

    AREA HelloW, CODE, READONLY
    

    The linker probably expects to find:

    AREA RESET, CODE, READONLY
    

    If you look at the scatter file that you get in your output directory, you'll notice that it wants to place a region RESET first in the LR_IROM1 area, and if there is no RESET, that will be very hard to do.

Reply
  • The warning that you don't need a library is just that - a warning.

    But another thing. Your assembler file specifies:

    AREA HelloW, CODE, READONLY
    

    The linker probably expects to find:

    AREA RESET, CODE, READONLY
    

    If you look at the scatter file that you get in your output directory, you'll notice that it wants to place a region RESET first in the LR_IROM1 area, and if there is no RESET, that will be very hard to do.

Children
  • @Andy: I figured as much too.In fact i tried to replace the START by main (main ADR r1,TEXT) but in vain
    @Per : You're right;

    ; *************************************************************
    ; *** Scatter-Loading Description File generated by uVision ***
    ; *************************************************************
    
    LR_IROM1 0x00000000 0x00040000  {  ; load region
      ER_IROM1 0x00000000  {       ; load address = execution address
       *.o (RESET, +First)
       * (+RO)
      }
      RW_IRAM1 0x40000000 0x00004000  {  ; RW data
       * (+RW +ZI)
      }
    }
    


    But how do i overcome it ?

    Thanks for the input guys, but it would really help if you can

    1)direct me to a stepwise procedure as to how to simulate the hello world program (or any assembly program for that matter) in KEIL without actually downloading it on to the target.

    2)Tell me if the startup file is needed for simulations too.

    Sorry if the queries are basic but i'm a newbie.