Skip to main content
Olivier Bontron
Associate II
Oct 20, 2019 8:44 PM UTC
Solved

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

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.
    Ulysses HERNIOSUS
    ST Technical Moderator
    Oct 23, 2019 6:17 AM UTC

    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

    9 replies

    Tesla DeLorean
    Guru
    Oct 21, 2019 1:29 AM UTC

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

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    Olivier Bontron
    Associate II
    Oct 21, 2019 7:33 AM UTC

    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

    Tesla DeLorean
    Guru
    Oct 21, 2019 7:41 AM UTC

    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.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    Ozone
    Principal
    Oct 21, 2019 6:00 AM UTC

    > 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.

    Ulysses HERNIOSUS
    ST Technical Moderator
    Oct 21, 2019 1:12 PM UTC

    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

    Olivier Bontron
    Associate II
    Oct 22, 2019 5:16 PM UTC

    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

    Olivier Bontron
    Associate II
    Oct 22, 2019 5:36 PM UTC

    Additional information

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

    Thanks

    Olivier

    Ulysses HERNIOSUS
    ST Technical Moderator
    Oct 23, 2019 6:17 AM UTC

    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

    Olivier Bontron
    Associate II
    Oct 26, 2019 1:10 PM UTC

    Ulysses,

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

    Best regards

    Olivier Bontron