Skip to main content
Visitor II
October 20, 2019
Solved

F401RE + NFC05A1 . Error ram overflowed. Any way to make more space ?

  • October 20, 2019
  • 6 replies
  • 1352 views

Error message is

c:/eclipse/plugins/fr.ac6.mcu.externaltools.arm-none.win32_1.17.0.201812190825/tools/compiler/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/bin/ld.exe: region `RAM' overflowed by 957840 bytes.

Output.map tells

_estack = 0x20018000

Using eclipse,

Is there any way to make more space so that the code could compile? For this project, I only need 14443A.

Thanks in advance.

Olivier Bontron

    This topic has been closed for replies.
    Best answer by Ulysses HERNIOSUS

    Hi,

    static uint8_t filterlut[1 << 20];

    evaluates to:

    static uint8_t filterlut[1048576];

    The code you are using is not adequate for usage on such a small controller. I see a LOWMEM compile time switch - don't know if it is operational or what it does.

    Regards, Ulysses

    6 replies

    Graduate II
    October 21, 2019

    What are you doing that needs 1.25MB ​of RAM on a part with a fraction of that?

    Visitor II
    October 21, 2019

    Hi, thanks for answering.

    I have been using STM32F4xx-Nucleo-Polling without any problem compiling up to the point where I added 3 files, respectively 100 lines 3k, 100 lines 3k and 500 lines 16k long. No reason to overflow by 1MB.

    Olivier

    Graduate II
    October 21, 2019

    So perhaps some PC centric code with some large arrays?

    Review the code to better understand it, and look at the .MAP for likely ​candidates.

    Explorer
    October 21, 2019

    > Output.map tells

    > _estack = 0x20018000

    This is the location, not the size.

    > I only need 14443A.

    This are 1.328.186 bytes. Quite a bit more then the 96k your MCU has.

    Check your map file.

    Technical Moderator
    October 21, 2019

    Hi,

    Maybe you can use ISO 15693 - produces much smaller numbers....

    *SCNR*

    I think there is some misunderstanding happening: Olivier is referring to ISO14443/A and not to a size of 0x14443a....

    But the rest of the comments are right.... Look at the map file if it is created. If not you can always execute one of "fromelf.exe -z", "size" (GNU binutils), "objdump" (GNU binutils) to see the sizes of the obj files. Especially look at the RAM.

    Regards, Ulysses

    Visitor II
    October 22, 2019

    Hi

    I identified that the error message takes place when I add this code :

    #define filter(x) (filterlut[(x) & 0xfffff])

    The complete code is : (the context is encryption)

    #if !defined LOWMEM && defined __GNUC__

    static uint8_t filterlut[1 << 20];

    static void __attribute__((constructor)) fill_lut(void)

    {

     uint32_t i;

     for (i = 0; i < 1 << 20; ++i)

      filterlut[i] = filter(i);

    }

    #define filter(x) (filterlut[(x) & 0xfffff])

    #endif

    Commented : ok

    With //#define filter(x) (filterlut[(x) & 0xfffff]) :

    It compiles and the map tells :

    ...

    .text.filter  0x00000000    0x68 Middlewares/ST/RFAL/rfal_nfca.o

     .text.startup.fill_lut       0x00000000    0x2 Middlewares/ST/RFAL/rfal_nfca.o

     .text.crypto1_create       0x00000000    0x6c Middlewares/ST/RFAL/rfal_nfca.o

     .text.crypto1_destroy        0x00000000    0x4 Middlewares/ST/RFAL/rfal_nfca.o

     .text.crypto1_get_lfsr        0x00000000    0x4c Middlewares/ST/RFAL/rfal_nfca.o

     .text.crypto1_bit        0x00000000    0x60 Middlewares/ST/RFAL/rfal_nfca.o

     .text.crypto1_byte        0x00000000    0x30 Middlewares/ST/RFAL/rfal_nfca.o

     .text.crypto1_word ...

    Name       Origin       Length       Attributes

    RAM       0x20000000     0x00018000     xrw

    FLASH      0x08000000     0x00080000     xr

    *default*    0x00000000     0xffffffff

    Uncommented : error

    With #define filter(x) (filterlut[(x) & 0xfffff])

    It does not compile.

    The error message :

    c:/eclipse/plugins/fr.ac6.mcu.externaltools.arm-none.win32_1.17.0.201812190825/tools/compiler/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/bin/ld.exe: STM32F4xx-Nucleo-Polling.elf section `.bss' will not fit in region `RAM'

    c:/eclipse/plugins/fr.ac6.mcu.externaltools.arm-none.win32_1.17.0.201812190825/tools/compiler/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/bin/ld.exe: region `RAM' overflowed by 957832 bytes

    and within the map, no mention of filter any longer. It tells :

    .text     0x00000000    0x0 Middlewares/ST/RFAL/rfal_nfca.o

     .data     0x00000000    0x0 Middlewares/ST/RFAL/rfal_nfca.o

    .text.crypto1_create        0x00000000    0x6c Middlewares/ST/RFAL/rfal_nfca.o

     .text.crypto1_destroy         0x00000000    0x4 Middlewares/ST/RFAL/rfal_nfca.o

     .text.crypto1_get_lfsr         0x00000000    0x4c Middlewares/ST/RFAL/rfal_nfca.o

     .text.crypto1_bit         0x00000000    0x64 Middlewares/ST/RFAL/rfal_nfca.o

     .text.crypto1_byte         0x00000000    0x30 Middlewares/ST/RFAL/rfal_nfca.o

     .text.crypto1_word        ...

    Name       Origin       Length       Attributes

    RAM       0x20000000     0x00018000     xrw

    FLASH      0x08000000     0x00080000     xr

    *default*    0x00000000     0xffffffff

    Regards,

    Olivier

    Visitor II
    October 22, 2019

    Additional information

    Highest address in the 2000xxxx range is         0x20001d88        . = ALIGN (0x8)

    Thanks

    Olivier

    Technical Moderator
    October 23, 2019

    Hi,

    static uint8_t filterlut[1 << 20];

    evaluates to:

    static uint8_t filterlut[1048576];

    The code you are using is not adequate for usage on such a small controller. I see a LOWMEM compile time switch - don't know if it is operational or what it does.

    Regards, Ulysses

    Visitor II
    October 26, 2019

    Ulysses,

    You were right, that was the culprit and so far, there was no necessity.

    Best regards

    Olivier Bontron