We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I have just started writing assembly code. I am using the simulator in Keil uvision5 to the run the code below. I dont understand why I can't see the src data value of 14 in register r1 when I ldr the data value from the address stored in the r0 register. I have tried to research the solution myself but cant find an exact reason why this happens. Any help would be gratefully appreciated.
THUMB AREA RESET, CODE, READONLY EXPORT __Vectors EXPORT Reset_Handler __Vectors DCD 0x20001000 DCD Reset_Handler AREA Code, CODE, READONLY ENTRY Reset_Handler LDR r0, =src LDR r1, [r0] terminate ; sit in an endless loop B terminate ; data area that can be modified (readwrite) AREA Data, DATA, READWRITE src DCD 14 END
THUMB AREA RESET, CODE, READONLY EXPORT __Vectors __Vectors DCD 0x20001000 DCD Reset_Handler AREA Code, CODE, READONLY ENTRY Reset_Handler PROC EXPORT Reset_Handler IMPORT ||Lib$$Request$$armlib|| ; Pull in library IMPORT __scatterload ; Scatter Loader BL __scatterload ; Initialize statics in RAM ; jumps to __main_after_scatterload ENDP ; Reset_Handler __main_after_scatterload PROC EXPORT __main_after_scatterload LDR r0, =src LDR r1, [r0] ldr r1, =123 mov r1, #456 LDR r0, =foo LDR r1, [r0] B . ; sit in an endless loop ENDP ; __main_after_scatterload foo DCD 1234 ; In ROM ; data area that can be modified (readwrite) AREA Data, DATA, READWRITE src DCD 14 END
Thanks that code works great. Problem solved.