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 want to use MICROLIB as (from my initial measurements) it appears to offer space savings of around 1.4KB.
However, I am having problems getting it to work with an initialised STACK. I want to initialise the stacks to known values (e.g. "STAC") for debugging and stack sizing purposes and have modified "startup.s" accordingly. This worked fine without MICROLIB, but using MICROLIB causes a crash. What appears to happen is as follows :-
1) At the start of _main, library code is called to perform initialisation (R/W and ZI). 2) LR (and R4) are pushed on the stack. 3) The stack contents are then initialised to the specified value, overwriting the saved LR (and R4). 4) The LR (and R4) are popped of the stack and the code attempts to branch to the value stored in LR (now "STAC").
I have tried adding an uninitialised ("NOINIT") 8 bytes at the end of the initialised stack, and can configure it so that this area is used for the two register pushes, but these 8 bytes are still being zero-initialised - I don't know why.
The stack declaration looks like this :-
GBLA count AREA STACK, READWRITE, ALIGN=3 Stack_Mem count SETA 0 WHILE count < (Stack_Size / 4) count SETA (count + 1) DCD STACK_INIT_VAL WEND AREA STACK, NOINIT, READWRITE, ALIGN=3 SPACE 8 __initial_sp Stack_Top EQU (Stack_Mem + Stack_Size + 8)
Any ideas how I can either actually prevent the initialisation of a "NOINIT" section, or get around this in another way ?
Also, is there any easier way to initialise a block of data than the above, which seems overly complex compared to other assemblers I have used. I would expect some sort of declaration that allowed me to specify the size, number of items and initial value. I'm sure I'm missing something obvious but can't find it in the online help.
Thanks,
David.
I spoke too soon.
Using the above GROUP, the code works, but the STACK is NOT initialised with the specified value, and I have no idea why not.