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.
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?
Finally I wrote a program which can be compiled in Keil:
; <h> Stack Configuration ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Stack_Size EQU 0x00000200 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp ; <h> Heap Configuration ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Heap_Size EQU 0x00000000 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit PRESERVE8 THUMB ; Vector Table Mapped to Address 0 at Reset AREA RESET, DATA, READONLY EXPORT __Vectors __Vectors DCD __initial_sp ; Top of Stack DCD Reset_Handler ; Reset Handler AREA Program, CODE, READONLY EXPORT Reset_Handler ;Defines the program starting point ;Program start Reset_Handler MOV R1, #0 MOVW R3, #0xC040 ;P2.2, P2.3, P2.4, P2.5, and P2.6 function mode is located at FP2DIR (0×2009_C040). MOVT R3, #0x2009 MOVW R2, #0x007C ;P2.2 -> Bit[2] * P2.3 -> Bit[3]* P2.4 -> Bit[4]* P2.5 -> Bit[5]* P2.6 -> Bit[6] -> Output dir : 1 MOVT R2, #0x0000 ;/* b0000_0000_0000_0000_0000_0000_0111_1100 */ STR R2, [R3, #0] loop B loop END
The first part was copied from build-in startup file. But it didn't fix the problem....