Keil Logo

ARMCC: CONVERTING A PROJECT TO MICROLIB

QUESTION

How can I convert my existing project to use MicroLib?

When I check Use MicroLIB in my project options, RealView gives me the following errors:

Error: L6218E: Undefined symbol __use_two_region_memory.
Error: L6218E: Undefined symbol __initial_sp.

ANSWER

To use MicroLIB with an existing project, you need to make a few changes to your Startup.s module.

First, replace the code:

Stack_Size      EQU     (UND_Stack_Size + SVC_Stack_Size + ABT_Stack_Size + \ 
                         FIQ_Stack_Size + IRQ_Stack_Size + USR_Stack_Size)

                AREA    STACK, NOINIT, READWRITE, ALIGN=3

Stack_Mem       SPACE   Stack_Size

Stack_Top       EQU     Stack_Mem + Stack_Size

...with the following (note the removal of USR_Stack_Size from the second line).

ISR_Stack_Size  EQU     (UND_Stack_Size + SVC_Stack_Size + ABT_Stack_Size + \ 
                         FIQ_Stack_Size + IRQ_Stack_Size)

                AREA    STACK, NOINIT, READWRITE, ALIGN=3

Stack_Mem       SPACE   USR_Stack_Size
__initial_sp    SPACE   ISR_Stack_Size
Stack_Top

Then, change the code:

                MOV     SP, R0
                SUB     SL, SP, #USR_Stack_Size

...to...

                IF      :DEF:__MICROLIB

                EXPORT __initial_sp

                ELSE

                MOV     SP, R0
                SUB     SL, SP, #USR_Stack_Size

                ENDIF

Change:

Heap_Mem        SPACE   Heap_Size

...to...

__heap_base
Heap_Mem        SPACE   Heap_Size
__heap_limit

Finally, add the following code before the "User Initial Stack & Heap" comment, and add an ENDIF before the END statement of the module.

                IF      :DEF:__MICROLIB

                EXPORT  __heap_base
                EXPORT  __heap_limit

                ELSE

SEE ALSO

FORUM THREADS

The following Discussion Forum threads may provide information related to this topic.

Last Reviewed: Tuesday, March 23, 2010


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.