Improving build system

Liste des GroupesRevenir à ca embedded 
Sujet : Improving build system
De : pozzugno (at) *nospam* gmail.com (pozz)
Groupes : comp.arch.embedded
Date : 13. May 2025, 16:57:40
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vvvq5j$1lml0$1@dont-email.me>
User-Agent : Mozilla Thunderbird
As some of you remember, some weeks ago we had a discussion on the build system of an embedded project.  I declared I usually use the graphical IDE released by silicon manufacturer (in my case, Atmel Studio and MCUXpresso IDE) and some of you suggested to improve this build system using a command line tool, such as the universal make.  Better if used in Linux or Linux-based system, such as msys or WSL.
I also declared I had many issues fine tuning a cross-platform Makefile that works in Windows and Linux-like shells at the same time and some of you suggested to use only WSL or msys, not Windows CMD shell.
Recently I found some time to try again and I wrote a decent Makefile as a starting point.  Now the command make, launched in a msys/mingw32 shell, is able to build my project, at least a specific build configuration, what I name "simulator".
My projects usually have multiple build configurations. A few for different models of the same device, such as LITE, NORMAL and FULL.
Moreover, I have at least two different targets: embedded and simulator. The embedded target is the normal product, usually running on a Cortex-M or AVR8 MCU. The simulator target runs directly on Windows. I use it very often, because I found it's much faster and simpler to build native binaries and debug such processes. Of course, building a simulator needs a different compilers, such as msys2/mingw32 or WSL/gcc.
I also have a DEBUG build configuration (target=embedded) useful for some debugging directly on the target (no watchdog, uart logging enabled and so on).
So I could have 7 different build configurations: LITE|NORMAL|FULL for EMBEDDED|SIMULATOR plus DEBUG.
I think it isn't difficult to change my Makefile to process commands of type:
    make CONFIG=LITE TARGET=embedded
    make CONFIG=FULL TARGET=simulator
    make CONFIG=DEBUG
There are many compiler options that are common to all builds (-Wall, -std=c99 and so on).  Some options are target specific (for example -DQUARTZ_FREQ_MHZ=16 -Isrc/ports/avr8 for embedded or -Isrc/ports/mingw32 for simulator).
I could generate the correct options by using ifeq() in Makefile.
How to choose the correct toolchain? Embedded target needs arm-gcc toolchain, for example in
   C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\arm\arm-gnu-toolchain\bin
while simulator targets needs simply gcc.
How do you choose toolchain in Makefile?  I think one trick is using the prefix.  Usually arm-gcc is arm-none-eabi-gcc.exe, with "arm-none-eabi-" prefix.  Is there other approach?
I don't know if I could install arm-gcc in msys2 (I'm quite sure I can install it in WSL), but for legacy projects I need to use the Atmel Studio toolchain.  How to call Atmel Studio arm toolchain installed in
   C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\arm\arm-gnu-toolchain\bin
from msys shell?  Should I change the PATH and use arm-none-eabi- prefix?

Date Sujet#  Auteur
13 May 25 * Improving build system19pozz
13 May 25 +- Re: Improving build system1Nicolas Paul Colin de Glocester
14 May 25 +* Re: Improving build system16David Brown
14 May 25 i+* Re: Improving build system11pozz
15 May 25 ii+* Re: Improving build system4Nicolas Paul Colin de Glocester
15 May 25 iii`* Re: Improving build system3David Brown
16 May 25 iii `* Re: Improving build system2Nicolas Paul Colin de Glocester
16 May 25 iii  `- Re: Improving build system1David Brown
15 May 25 ii`* Re: Improving build system6David Brown
15 May 25 ii `* Re: Improving build system5pozz
16 May 25 ii  `* Re: Improving build system4David Brown
16 May 25 ii   `* Re: Improving build system3pozz
16 May 25 ii    `* Re: Improving build system2David Brown
16 May 25 ii     `- Re: Improving build system1pozz
15 May 25 i+- Re: Improving build system1David Brown
16 May 25 i`* Re: Improving build system3pozz
16 May 25 i `* Re: Improving build system2David Brown
17 May 25 i  `- Re: Improving build system1pozz
14 May 25 `- Re: Improving build system1Stefan Reuther

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal