compile-time-init-build icon indicating copy to clipboard operation
compile-time-init-build copied to clipboard

🔬👾Add an example for a real embedded system

Open lukevalenty opened this issue 3 years ago • 14 comments
trafficstars

There should be an example that can be built and experimented with on a real embedded board. Arduino might be nice due to its popularity.

https://github.com/a9183756-gh/Arduino-CMake-Toolchain

lukevalenty avatar Apr 13 '22 23:04 lukevalenty

@lukevalenty -

What do you think about https://platformio.org/?

There are many more popular low-cost embedded boards (mostly targetting hobbyists - but not only). PlatformIO has a coherent library management system - is able to set up toolchain automatically, etc.

Many thanks for such a great concept and library!

Regards, Daniel

Jasinsky avatar Oct 29 '22 16:10 Jasinsky

I haven't used platformio myself, but it looks intriguing. Could be a good learning opportunity for myself. 🙂

lukevalenty avatar Oct 29 '22 16:10 lukevalenty

Me too! I wish to see a more hardware oriented example of cib.hpp. Something like a Arduino LED blinker controlled by a push button.

Examples: https://godbolt.org/z/Y983h4 https://github.com/boost-ext/sml

antonysigma avatar Nov 18 '22 18:11 antonysigma

@lukevalenty ,

Hi Luke, I recently saw your presentation and example using Atiny device for this (excellent btw), it might be a good start and example for a real embedded platform, but I was looking for it under this repo and could not find it. Is this something you can share or help to setup for us mere mortals?

Thanks,

mhanuel26 avatar Dec 13 '23 05:12 mhanuel26

Hi @mhanuel26! We have been tossing around the idea of making a separate repo that pulls together all of our C++ baremetal libraries/framework into a dev kit that can be used for various microcontrollers. Stay tuned!

lukevalenty avatar Dec 13 '23 16:12 lukevalenty

@lukevalenty Given the dependency on C++20 standard and the most recent gcc toolchain, what is the strategy of unifying the gcc build environments in the dev kit? Just curious.

@mhanuel26 Same here. I am also hoping to see the real world, end to end example of CIB as demonstrated in the ATTiny seminar. While we are waiting, have you tried the modm framework? They have a pretty good tutorial on setting up GCC compiler for ATTiny MCUs. The one on the Microchip website is outdated and not suitable for CIB.

antonysigma avatar Dec 13 '23 16:12 antonysigma

@antonysigma: We are planning on using cmake and setup cmake toolchains for each of the targets. AVR, ARM, RISCV, and ARCv2 all have compatible toolchains.

lukevalenty avatar Dec 13 '23 16:12 lukevalenty

Re: CMake. @lukevalenty Great! I am looking forward to it.

I hit roadblocks with CMake in the past with the Canadian cross compilation pattern. CMake needed a separate build folders for the generated executables, in order to generate headers/cpp like what we do in CIB::logging. Link here. I am glad CIB doesn't make the logging parsing tool a cpp requiring "native" compilation.

I use Meson build though. Probably I will port your examples over to Meson once CIB has a dev kit.

antonysigma avatar Dec 13 '23 16:12 antonysigma

Hi @lukevalenty I know you are super busy and I have see you very active here but so far no joy with the the dev. kit example. I myself don't have any clue where to start, maybe you can share something here to star playing around and get familiar with library? Or maybe some instructions how to set up the AVR example and go from there? Thanks a mil

mhanuel26 avatar Feb 20 '24 17:02 mhanuel26

@lukevalenty : I thought your cppcon talk from last year would be starting point for all!?

Composition on Tiny Embedded Systems in C++

Can that be added as an example here!?

basavarajubv avatar Feb 20 '24 18:02 basavarajubv

We are working on a dedicated repo that can be used to build projects with CIB. It's a bit more involved that what fits in the example folder. :( Stay tuned.

lukevalenty avatar Feb 20 '24 18:02 lukevalenty

I am also half-way through implementing a blinky demo with CIB with compile-time logging features. Here: https://github.com/antonysigma/compile-time-init-build?tab=readme-ov-file#quick-start

The gotcha is that we have to rollback cib to the version before the libfmt integration.

Here's the list of additional changes teach cib to to call libarduino APIs: https://github.com/antonysigma/compile-time-init-build/pull/1/files

antonysigma avatar Mar 05 '24 06:03 antonysigma

An update for year 2025: I am still stuck in a pre-#338 version of CIB because the AVR-gcc toolchain is missing stdexcept, string headers in order to #include <fmt/format.h>.

I have a working blinky demo here with the ability to flash to Arduino UNO: https://github.com/antonysigma/compile-time-init-build/pull/1

Help wanted to rebase to top-of-tree, and to patch CIB in order to evaluate the CIB's indexed handler feature on AVR MCUs (#255).

antonysigma avatar Feb 10 '25 21:02 antonysigma

Also of note:

  • https://wg21.link/p3378 is headed for C++26

Ben Craig is working to bring a lot of functionality to freestanding:

  • https://wg21.link/p2976 is headed for C++26
  • https://wg21.link/p3295 may be close behind?

elbeno avatar Feb 18 '25 18:02 elbeno