platformio / builder-framework-mbed

ARM mbed build script for PlatformIO Build System
http://platformio.org/frameworks/mbed
Apache License 2.0
4 stars 17 forks source link

build_unflags not working on "libs" directories (rtos, USB, etc) #13

Open stefaandesmet2003 opened 5 years ago

stefaandesmet2003 commented 5 years ago

Hi, I'm using the platformIO extension in VS Code, and building a debug version of the mbed-rtos example code, using the platformio.ini below, setting extra debug flags, and unsetting the defaults.

The flags are applied to the "core" files, main.c etc, but not to the "rtos" files. As a result I cannot properly debug into these files.

In BLUEPILL_F103C8.json these files are under the "libs" element. The same behavior occurs with the USBDevice files, which are also under "libs" (that's how i came across this problem; I was playing around with the USBDevice stack on bluepill and needed debugging on the usb files).

[env:bluepill_f103c8_debug] platform = ststm32 framework = mbed board = bluepill_f103c8 build_flags = -DPIO_FRAMEWORK_MBED_RTOS_PRESENT, -g3, -Og build_unflags = -Os, -O1, -O2, -O3, -g1

excerpt from the verbose build :

arm-none-eabi-g++ -o .pioenvs/bluepill_f103c8_debug/lib7ec/rtos/ThisThread.o -c -std=gnu++98 -fno-rtti -Wvla -g3 -Og -mcpu=cortex-m3 -mthumb -c -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -fmessage-length=0 -fno-exceptions -fno-builtin -ffunction-sections -fdata-sections -funsigned-char -MMD -fno-delete-null-pointer-checks -fomit-frame-pointer -Os -DNDEBUG -g1 -include mbed_config.h -DPLATFORMIO=30604 ...

arm-none-eabi-g++ -o .pioenvs/bluepill_f103c8_debug/lib7ec/rtos/Thread.o -c -std=gnu++98 -fno-rtti -Wvla -g3 -Og -mcpu=cortex-m3 -mthumb -c -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -fmessage-length=0 -fno-exceptions -fno-builtin -ffunction-sections -fdata-sections -funsigned-char -MMD -fno-delete-null-pointer-checks -fomit-frame-pointer -Os -DNDEBUG -g1 -include mbed_config.h -DPLATFORMIO=30604 ...

arm-none-eabi-g++ -o .pioenvs/bluepill_f103c8_debug/src/main.o -c -std=gnu++98 -fno-rtti -Wvla -g3 -Og -mcpu=cortex-m3 -mthumb -c -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -fmessage-length=0 -fno-exceptions -fno-builtin -ffunction-sections -fdata-sections -funsigned-char -MMD -fno-delete-null-pointer-checks -fomit-frame-pointer -DNDEBUG -include mbed_config.h -DPLATFORMIO=30604 ...

ivankravets commented 5 years ago

Could you try upstream version? https://docs.platformio.org/en/latest/platforms/ststm32.html

We updated mbed builder but has not been released it yet

stefaandesmet2003 commented 5 years ago

Thanks, that works! But the build is very slow, it builds all the files in the framework, also files that aren't included in my application (like lwip, mbedtls, etc). I guess that's work in progress ? Cheers, Stefaan

ivankravets commented 5 years ago

We switched to official mbed-OS source files provider to be maximum compatible with their builder and add support for mbed_app.json.

stefaandesmet2003 commented 5 years ago

Hi Ivan, what help is wanted? glad to help, but am only starting to learn about mbed os, mbed-cli vs framework-mbed in platformio, so would need some directions .. Is it possible through mbed_app.json to reduce the number of unused features that are built each time?

ivankravets commented 5 years ago

Is it possible through mbed_app.json to reduce the number of unused features that are built each time?

@valeros is it possible?

valeros commented 5 years ago

Hi @stefaandesmet2003 ! I'm not sure whether it's possible to disable particular parts of the framework using the configuration file, but at least you can try to remove unused folders by adding a special empty file .mbedignore to them.

rijesha commented 5 years ago

Hi @valeros . Where would the .mbedignore file be added?

valeros commented 5 years ago

Hi @rijesha! You need to add this file to each directory you want to ignore. The framework package is located here: YOUR_HOME_DIR/.platformio/packages/framework-mbed

didi110296 commented 4 years ago

Hi @rijesha! You need to add this file to each directory you want to ignore. The framework package is located here: YOUR_HOME_DIR/.platformio/packages/framework-mbed

Not working for me. Platformio compile all framework mbed components and targets, does anyone know how compile only necessary components/features?

Thanks, regards.

valeros commented 4 years ago

@didi110296 What exactly do you want to omit? Have you tried adding directory names or * to .mbedignore? You can create a new file .mbedignore with only one symbol * in this file and place it for example here: YOUR_HOME_DIR/.platformio/packages/framework-mbed/components/.mbedignore then the entire folder components shouldn't be compiled.

didi110296 commented 4 years ago

@valeros Thank you for you reply, I've tried to do that, i've put .mbedignore with this content : components/* features/cellular features/cryptocell features/device_key features/frameworks/* features/lorawan features/lwipstack features/mbedtls features/nanostack features/netsocket features/nfc features/storage features/unsupported

Here : .platformio/packages/framework-mbed/

But platformio continue compiling all components and features ...

Compiling .pio/build/nrf52_dk/FrameworkMbed/components/802.15.4_RF/atmel-rf-driver/source/NanostackRfPhyAtmel.o Compiling .pio/build/nrf52_dk/FrameworkMbed/components/802.15.4_RF/atmel-rf-driver/source/at24mac.o Compiling .pio/build/nrf52_dk/FrameworkMbed/components/802.15.4_RF/mcr20a-rf-driver/source/MCR20Drv.o Compiling .pio/build/nrf52_dk/FrameworkMbed/components/802.15.4_RF/mcr20a-rf-driver/source/NanostackRfPhyMcr20a.o

valeros commented 4 years ago

You need to put this file explicitly in the folder you want to ignore as we build all parts separately: For example: .platformio/packages/framework-mbed/components/.mbedignore file with only one symbol: * .platformio/packages/framework-mbed/features/.mbedignore with folder names:

cellular/*
cryptocell/*
device_key/*
didi110296 commented 4 years ago

Good that work, thank you :+1:

KKoovalsky commented 4 years ago

I created a simple python script which can be executed from the pre-script. See https://github.com/KKoovalsky/PlatformIO-Helpers.

It puts .mbedignore file with content *\n to each ignored path.

Can be used across multiple projects.

3nd0y commented 4 years ago

@valeros I tried to put file .mbedignore as you mention but the pio still include those folder/file

image

Any ideas?