I’m using platformIO in visual studio code, but I’m using a Raspberry Pi as an ISP for some AVR chips embedded in custom board.
I’m trying to set up targets so that I can create .hex files to use on the raspberry pi with avrdude to program several microcontrollers on the board.
My problem is that it doesn’t seem to be doing what I expect.
My platformio.ini file is as follows:
[env:uno]
platform = atmelavr
board = uno
framework = arduino
board_build.f_cpu = 8000000L
extra_scripts = post:extra_script.py
[test]
src_filter = +<*> -<.git/> -<svn/> -<example/> -<examples/> -<src>
What I expected was that running platformio run -e uno -t test
would build the source files in the test directory. extra_script.py just saves the hex output of the build for me, I’ve verified that it works when I run it without a target specified.
But when I run the command, I get the following:
PS U:\git\biobox\BioBox-Code\arduino\light_test> platformio run -e uno -t test -v
Processing uno (extra_scripts: post:extra_script.py; board_build.f_cpu: 8000000L; framework: arduino; platform: atmelavr; board: uno; src_filter: +<*> -<.git/> -<svn/> -<example/> -<examples/> -<src>)
----------------------------------------------------------------------------------------------------------
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/uno.html
PLATFORM: Atmel AVR 1.12.5 > Arduino Uno
HARDWARE: ATMEGA328P 8MHz, 2KB RAM, 31.50KB Flash
PACKAGES: toolchain-atmelavr 1.50400.0 (5.4.0), framework-arduinoavr 2.10623.190209 (1.6.23)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 12 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <SPI> 1.0 (C:\Users\dsball\.platformio\packages\framework-arduinoavr\libraries\__cores__\arduino\SPI)
|-- <StateManager> (U:\git\biobox\BioBox-Code\arduino\light_test\lib\StateManager)
| |-- <SPI> 1.0 (C:\Users\dsball\.platformio\packages\framework-arduinoavr\libraries\__cores__\arduino\SPI)
| |-- <CRC16> (U:\git\biobox\BioBox-Code\arduino\light_test\lib\CRC16)
`test' is up to date.
====================================== [SUCCESS] Took 2.19 seconds ======================================
I know the target is getting called, but it seems like the source filter isn’t doing anything … When I put it directly in [env:uno], the files in are compiled rather than files in as I expect, which seems to indicate that the option has no effect and that I’ve applied it wrong - what am I missing?
I’ve seen posts suggesting potential issues using preprocessor directives to ignore code segments based on build flags, but that seems clunky and bug prone … I’d like to just specify a target main source file using --target.