Bare metal custom board

I would like to use the platformio with a bare metal ATSAMD51 processor. That is not using Arduino or mbed, etc. I read through the documentation but do not understand how to do this. Basically I just want to select the compiler and debugger and then add my code.

Thanks
Trampas

Just leave out the framework = ... line in the platformio.ini, then no framework code is added.

So I do not need a framework to compile and upload code? How does platformIO know which processor, and compiler? How do I set the linker options, and compiler options?

We work on ability to start a project using DEVICE workflow instead of dev kits. A temporary solution is to use the most close board and do not define framework option.

1 Like

How do I select which compiler I want to use?

OK I have tried to figure out how to create custom board/platform, and it is very confusing.

For example I looked at the atmelsam platform and it is a confusing as there is a platform.json and platform.py which seems to duplicate information, why is the data duplicated? Also there is the builder for frameworks, ie arduino.py, simba.py, _bare.py, etc. It appears that these scripts define the compiler flags (CCFLAGS) thus it is a bit confusing how one would build a project for debugging (-O0) when in the build script it is hard coded for -Os. Specifically I usually compile code with -O0 when I am debugging and then compile with -Os for release builds. Sometimes I even have to compile some files -Os and then compile specific files I am debugging with -O0. Is this possible in PlaftormIO?

I can see the value in PlatformIO downloading the packages (tool chain, debugger, etc) that is needed for a board, however it appears to remove all flexibility and configuration for your project. So I am wondering if PlatformIO is intentionally this confusing, or am I missing some key design philosophy which is limiting my mental model of how PlatformIO is intended to work?

That is why would I choose to use PlatformIO over cmake or makefile?

1 Like

You can control build flags and unflag default. See

Can you change the build options per source file?

Also how does it handle flag conflicts, for example Arduino might use -Os, and you locally set project for -O0?

See Redirecting.... You can modify the CCFLAGS/CFLAGS for env and projenv independently, so it should be possible to mix -Os code with -O0 code. Use pio run -v to get verbose compile commands to verify this.

I could not figure it out in platformio and just went back to using eclipse. One day maybe when platformio has better documentation I will look at it again. Again it might be great to replace Arduino IDE, but it does not do what I need for ‘real’ embedded development.

I did get firmware building with good old fashion makefile which worked great but then the Cortex_debug plugin is not there yet for using vscode, in the two the three seconds of use I several bugs.

Eclipse IDE appears to be much more user friendly and stable. Sure the editor is not as ‘fast’ but I would rather have good slow tools than fast bad ones.

Trampas

1 Like

Is there a github item to track for “DEVICE” workflow?

Please subscribe to this issue