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

Asm programming

Hello
Where can I find some example programs only in asm to be compiled inder Keil MDK?
I can't compile simple programs as:

STACK_TOP   EQU   0x20002000         ; constant for SP starting value
            AREA  |Header Code|, CODE
            DCD    STACK_TOP  ; Stack top
            DCD    Start      ; Reset vector
            ENTRY             ; Indicate program execution start here
Start       ; Start of main program
            ; initialize registers
            MOV   r0,  #10    ; Starting loop counter value
            MOV   r1,  #0     ; starting result
            ; Calculated 10+9+8+...+1
loop
            ADD   r1,  r0     ; R1R1 + R0
            SUBS  r0,  #1     ; Decrement R0, update fl ag (“S†sufï¬ x)
            BNE   loop        ; If result not zero jump to loop
            ; Result is now in R1
deadloop
            B     deadloop    ; Inï¬ nite loop
            END               ; End of ï¬ le

Keil gives an error:
Error: L6320W: Ignoring --entry command. Cannot find argument 'Reset_Handler'.

How to change this program? How to change linker control string?

I tried also to add startup code fo nxp1766 but then i still have an error that label __main is missing.

Could You help me and give me some simple programs just to compile it properly?

Parents
  • I found the sollution. Probabely the program code was in reserver region. I copied all startup code (all vector table) and now it is working properly. I found it in dissasembled code. In all built in projects the first instruction was in higher address than 0x18 in my code.
    Now I use build in startup file but I have to comment one line:

     User Initial Stack & Heap
    
                    IF      :DEF:__MICROLIB
    
                    EXPORT  __initial_sp
                    EXPORT  __heap_base
                    EXPORT  __heap_limit
    
                    ELSE
    
    ; IMPORT  __use_two_region_memory
                    EXPORT  __user_initial_stackheap
    __user_initial_stackheap
    
                    LDR     R0, =  Heap_Mem
                    LDR     R1, =(Stack_Mem + Stack_Size)
                    LDR     R2, = (Heap_Mem +  Heap_Size)
                    LDR     R3, = Stack_Mem
                    BX      LR
    
                    ALIGN
    
                    ENDIF
    


    because i get following messages:
    blinky.axf: Warning: L6665W: Neither Lib$$Request$$armlib Lib$$Request$$cpplib defined, not searching ARM libraries.
    blinky.axf: Error: L6218E: Undefined symbol __use_two_region_memory (referred from startup_lpc17xx.o).

Reply
  • I found the sollution. Probabely the program code was in reserver region. I copied all startup code (all vector table) and now it is working properly. I found it in dissasembled code. In all built in projects the first instruction was in higher address than 0x18 in my code.
    Now I use build in startup file but I have to comment one line:

     User Initial Stack & Heap
    
                    IF      :DEF:__MICROLIB
    
                    EXPORT  __initial_sp
                    EXPORT  __heap_base
                    EXPORT  __heap_limit
    
                    ELSE
    
    ; IMPORT  __use_two_region_memory
                    EXPORT  __user_initial_stackheap
    __user_initial_stackheap
    
                    LDR     R0, =  Heap_Mem
                    LDR     R1, =(Stack_Mem + Stack_Size)
                    LDR     R2, = (Heap_Mem +  Heap_Size)
                    LDR     R3, = Stack_Mem
                    BX      LR
    
                    ALIGN
    
                    ENDIF
    


    because i get following messages:
    blinky.axf: Warning: L6665W: Neither Lib$$Request$$armlib Lib$$Request$$cpplib defined, not searching ARM libraries.
    blinky.axf: Error: L6218E: Undefined symbol __use_two_region_memory (referred from startup_lpc17xx.o).

Children
No data