Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
stefaandesmet2003 opened this issue Feb 1, 2019 · 15 comments

Comments

@stefaandesmet2003
Copy link

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
Copy link
Member

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
Copy link
Author

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
Copy link
Member

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

@stefaandesmet2003
Copy link
Author

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
Copy link
Member

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

@valeros is it possible?

@valeros
Copy link
Member

valeros commented Feb 19, 2019

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
Copy link

rijesha commented Jun 22, 2019

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

@valeros
Copy link
Member

valeros commented Jun 24, 2019

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
Copy link

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
Copy link
Member

valeros commented Oct 1, 2019

@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
Copy link

@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
Copy link
Member

valeros commented Oct 1, 2019

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
Copy link

Good that work, thank you 👍

@KKoovalsky
Copy link

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
Copy link

3nd0y commented Dec 29, 2019

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

image

Any ideas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants