• What should I add to board configs and compiler defines to make build of Espruino 2v22 for STM32F4 with RESIZABLE_JSVARS enabled?

    I added -DRESIZABLE_JSVARS into compiler options, but got this error:

    /usr/lib/gcc/arm-none-eabi/12.2.1/../../../arm-none-eabi/bin/ld: /usr/lib/gcc/arm-none-eabi/12.2.1/../../../arm-none-eabi/lib/thumb/v7e-m+fp/softfp/libg_nano.a(lib_a-sbrkr.o): in function `_sbrk_r':
    /home/pere/src/newlib-salsa/build_nano/arm-none-eabi/thumb/v7e-m+fp/softfp/newlib/libc/reent/../../../../../../../../newlib/libc/reent/sbrkr.c:51: undefined reference to `_sbrk'
    collect2: error: ld returned 1 exit status
    make[1]: *** [make/targets/ARM.make:3: bin/horizon_2v22_dponyatov_250110.elf] Error 1
    make[1]: Leaving directory '/home/dponyatov/Espruino'
    make: *** [mk/all.mk:5: all] Error 2
    

    What I need is enabling block allocation mode but build fw with three precompiled blocks:

    • RAM 128K
    • CCMRAM 48K (3/4 of CCMRAM)
    • optional extRAM (up to 16 Mb)

    PS: I take old 2v22 thus modern versions compiles into ELF file with broken LMA/VMA table but I don't have time to fix it (all source code debug info bounded to zero address etc)

  • What I need is enabling block allocation mode but build fw with three precompiled blocks:

    So you don't actually need resizable vars with its dynamic memory allocation, you need just 3 fixed separate blocks right from the start. sbrk is method to allocate memory (maybe malloc calls it internally?) - you don't need this to solve your problem?

    I don't think there is a solution for this combination but it could be useful. I'd like to have something similar on nrf52 too, currently the most simple way used for nrf52 and stm32 is (one) big static jsVars array which is put randomly somewhere by the linker just like any static variable. What I used before with nrf52 is to put it into fixed memory area - not malloc'ed but also not static array variable. What you want is advanced variation of this with 3 blocks. it could be implemented like RESIZABLE_JSVARS blocks but still fixed and all 3 created at startup instead of allocating dynamically.

About

Avatar for fanoush @fanoush started