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.
question 1: This is the original reset handler that is in the startup file (*.s)
Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =__main BX R0 ENDP
which i modify to
Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT OSInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =OSInit BLX R0 LDR R0, =__main BX R0 ENDP
Here the OSInit is a function. This works fine.
But when i modify the original to following, I get a hard fault.
Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT main IMPORT OSInit LDR R0, =SystemInit BLX R0 LDR R0, =main BLX R0 ;getting hardfault here LDR R0, =OSInit BX R0 ENDP
Irrespective of whether the OSInit is a function or a task, i get Hardfault.
question 2: does the '__' (two underscores) before 'main' have any significance. Because when i write __OSInit, the compiler is unable to locate OSInit function (Error L6218E: undefined symbol). but for '__main' the function name is always 'main' and compiler locates it.
NO, you refer to that link !
"Copies non-root (RO and RW) execution regions from their load addresses to their execution addresses. Also, if any data sections are compressed, they are decompressed from the load address to the execution address"
Now look in the mirror and say (X 100000 times): "yes, yes, yes, my kernel can run if I did not execute scatter load. yes, yes, yes I can !"
Maybe you can convince __main to branch to your kernel init function, but I doubt it.