POL
ENG

Building AVR code - build.py tool 1.0

If you came here only for script, then it is here:

And basically you could stop reading here, but if you would like to hear longer story, please feel invited. Till recently, to fiddle with AVR processors and theirs code I was using AVR-Studio IDE. Unfortunately, the newest version is rather large in size. Also recently I have discovered a Visual Studio Code, lighter but still nice version of Visual Studio from Microsoft. I found it a pain in the neck to set it up to work with AVRs. Trying to solve another problem I started getting feeling a temtation to write my own tool, that makes a dirty job for me. And you know what? It was worth. When I was implementing bootloader, I had to compare compilation codes and with this tool it took me only a few moments. After that success I started desire running a unit tests with GMock or GTest. That took me another moment. Later on, it was convinient program the chip automatically when compilation succed. Switch to distinguish between programming bootloader or normal program? Not a problem.

build.py

A few jurneys by traing to and return from work and here it is. It is live code. I still keep adopt it to current needs.

To start getting all benefits from this app, you need to take a moment and tell him what you want. On the begining, you need to define a chip:

mcu = "atmega32"

Another thing is to define which files are necessary to build this project and where are header files. In section of flags passed to different applications, you can define optimization level or clock frequency.

Avalable options:

Options:
  -h, --help            show this help message and exit
  -u, --unittests       runs unit tests
  -b, --bootloader      compile code as for boot loader purposes
  -s CODE_PATH, --source=CODE_PATH
                        top level code path
  -t TARGET, --target=TARGET
                        Executable file name
  -c, --clear           Removes all output files
  -r, --rebuild         Rebuilds whole project
  -x, --run-tests       Executes unit tests
  -d, --debug           Shows executed commands
  -p, --program_dev     Program device
  -a, --disassembly     Generates assembler code from elf file
  --filter-tests=TEST_FILTER
                        Regex to pick up only some tests

Typical usage:

python.exe build.py -s sciezkadoźródeł -t avr_program.elf

I'm encouraging to download and express you feelings in comment below.

Warning!

For proper work it requires existance of avr-gcc packaegs. You can find them in WinAvr or Arduino

Wszelkie prawa zastrzeżone. Projekt i wykonanie strony SrcPro.pl