This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to propagate a value from C to a SPACE directive with armasm

Hi all,

I would like to ask help to some expert in armasm.

In my startup.s file I have the following code which reserves 0x400 bytes of RAM to the stack.

; this is the original startup.s file
Stack_Size      EQU     0x00000400

                AREA    STACK, NOINIT, READWRITE, ALIGN=3
Stack_Mem       SPACE   Stack_Size
__initial_sp

Well, I would like to be able to initialise Stack_Size with a value which I have in a cfg.h file or with a const value which I have in a cfg.c file

// this is cfg.h file
#define STACK_SIZE  0x00000400
// this is cfg.c file
#include "cfg.h"
extern const int Stack_Size = STACK_SIZE;

The problem is that I dont know how to export the variable from C and import it into assembly.

I tried to use IMPORT, as in the following, but it does not work.

; this is the modified startup.s

                IMPORT Stack_Size
;Stack_Size      EQU     0x00000400
;               EXPORT  Stack_Size

                AREA    STACK, NOINIT, READWRITE, ALIGN=3
Stack_Mem       SPACE   Stack_Size
__initial_sp

Any suggestion?

Thanks in advance, Marco.

Parents
  • > Any thoughts...?

    Of course. You are suffering from an issue with armld that I reported in 2008 (case #394129) and has been fixed a short while after that.

    The behavior you seem to be experiencing started in RVCT 3.1 Build 700. The include paths are relative to the temporary directory!

    Although initially not acknowledged (to me anyway) as bug, ARM reverted the change and returned to the proper behavior a few releases later.

    --
    Marcus

Reply
  • > Any thoughts...?

    Of course. You are suffering from an issue with armld that I reported in 2008 (case #394129) and has been fixed a short while after that.

    The behavior you seem to be experiencing started in RVCT 3.1 Build 700. The include paths are relative to the temporary directory!

    Although initially not acknowledged (to me anyway) as bug, ARM reverted the change and returned to the proper behavior a few releases later.

    --
    Marcus

Children