Reusing the FreeRTOS and LwIP code in ~/.platformio/

I’m trying to use the code which is present inside this area:

.platformio/packages/framework-stm32cubef7/

In particular FreeRTOS and LwIP, both inside Middlewares/Third_Party/. One way to “reach” these libraries might have been to add symlinks from lib/ to the .../Third_Party/ folder, but it looks like that’s not recognised by pio.

Another way is via lib_extra_dirs:

lib_extra_dirs =
  /Users/jcw/.platformio/packages/framework-stm32cubef7/Middlewares/Third_Party/
lib_deps = FreeRTOS, LwIP

But that leads to problems with finding the correct headers (some appear in different versions in various subdirs), and PIO trying to compile source code in there which is not intended for embedded use but as tool on the host:

.../.platformio/packages/framework-stm32cubef7/Middlewares/Third_Party/LwIP/src/apps/http/makefsdata/makefsdata.c:77:2: error: #error makefsdata not supported on this platform

So my question is: is there a way to properly compile and link to the code in Middlewares (and if not, what is the purpose of installing this code?). The options I’ve described feel a bit like a hack (and … don’t work) - I’d rather follow best practices.

Update - here’s the platformio.ini file from my last attempt:

[paths]
third_party = /Users/jcw/.platformio/packages/framework-stm32cubef7/Middlewares/Third_Party

[env]
platform = ststm32
framework = stm32cube
board_build.stm32cube.custom_config_header = yes
monitor_speed = 115200
lib_extra_dirs = ${paths.third_party}
lib_deps = FreeRTOS, LwIP

[env:f767]
board = nucleo_f767zi
build_flags =
    -I src
    -I ${paths.third_party}/FreeRTOS/Source/include
    -I ${paths.third_party}/FreeRTOS/Source/CMSIS_RTOS
    -I ${paths.third_party}/FreeRTOS/Source/portable/GCC/ARM_CM7/r0p1
    -I ${paths.third_party}/LwIP/src/include
    -I ${paths.third_party}/LwIP/system
    -I build

And here’s the first fatal error from pio run:

/Users/jcw/.platformio/packages/framework-stm32cubef7/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM23/non_secure/port.c:45:11: fatal error: secure_context.h: No such file or directory

IOW, it looks like it’s trying to compile files which are not relevant here.

3 Likes

I’m also interested in achieving the same.

Any one has some suggestion?

Kinda stuck with this as well. Can someone please help out?