I want to try programming in asm. How to connect startup file with new asm file?
I make this code:
GLOBAL prog1 AREA reset, CODE, READONLY ENTRY prog1 MOV R0, #11 stop B stop END
I saw in startup code "Enter C code " and then it is calling IMPORT __main. How to change it, so it will import my new asm function?
; Enter the C code IMPORT __main LDR R0, =__main BX R0 IF :DEF:__MICROLIB EXPORT __heap_base EXPORT __heap_limit ELSE ; User Initial Stack & Heap AREA |.text|, CODE, READONLY IMPORT __use_two_region_memory EXPORT __user_initial_stackheap __user_initial_stackheap LDR R0, = Heap_Mem LDR R1, =(Stack_Mem + USR_Stack_Size) LDR R2, = (Heap_Mem + Heap_Size) LDR R3, = Stack_Mem BX LR ENDIF END
Programming in assembler is all about freedom. You can do just about anything you like.
So what about the three options that you either: - make your own "start" function named __main? - modify the startup file and changes __main into another symbol name? - throw away the startup file and write your own - it is after all just standard assembler code.
You really do have to make huge amounts of decisions when programming - and you can't make use of forums when making your decisions.
Think about it: what use do you have of heap symbols if you are not going to implement any code that allocates memory from a heap? Decisions, decisions, ...