ARM Technical Support Knowledge Articles

CONVERTING A PROJECT TO MICROLIB

Applies to: RealView C Compiler

Answer

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

ATTACHED FILES

Request the files attached to this knowledgebase article.

Article last edited on: 2010-03-23 09:11:47

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential