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

Need help with simple assembly language program

Hello, I teach Computer Architecture at the University of Washington Bothell campus. I'm teaching the ARM 7 architecture for the first time and this is the first time I'm using the uVision toolset. I'm having trouble getting simple programs to assemble and link so I can single step them in the ISS so I can do simple demos for my students and have them do simple programming assignments. I seem to be stymied by the linker. Can someone send me a simple skeleton that I can use to create short programs that I can use?

What I've tried so far. I got a sample program from the ARM ADS 1.2 CD-ROM that I have (shown below). I added the label, __main and place the pseudo-op instruction,
EXPORT __main. That seemed to fix one error and introduced another one. I seem to always be one error away from getting it to build. I included the startup.s file in the project. Here is the error message that I receive:

ASM_test.axf: Error: L6218E: Undefined symbol __use_two_region_memory (referred from startup.o)

Thanks in advance for any help that you could provide.

Arnie

Here's my program code:


AREA    Jump, CODE, READONLY    ; name this block of code
        CODE32                          ; Following code is ARM code

num     EQU     2               ; Number of entries in jump table

        ENTRY                   ; mark the first instruction to call
;removed start
__main
        MOV     r0, #0          ; set up the three parameters
        MOV     r1, #3
        MOV     r2, #2
        BL      arithfunc       ; call the function

stop
        MOV     r0, #0x18       ; angel_SWIreason_ReportException
        LDR     r1, =0x20026    ; ADP_Stopped_ApplicationExit
        SWI     0x123456        ; ARM semihosting SWI

arithfunc                       ; label the function
        CMP     r0, #num        ; Treat function code as unsigned integer
        MOVHS   pc, lr          ; If code is >= num then simply return
        ADR     r3, JumpTable   ; Load address of jump table
        LDR     pc, [r3,r0,LSL#2]       ; Jump to the appropriate routine

JumpTable
        DCD     DoAdd
        DCD     DoSub

DoAdd
        ADD     r0, r1, r2      ; Operation 0
        MOV     pc, lr          ; Return

DoSub
        SUB     r0, r1, r2      ; Operation 1
        MOV     pc,lr           ; Return
                EXPORT  __main

        END                     ; mark the end of this file

Parents Reply Children
No data