I have been bashing my head against the wall with this for quite some time, I can include the D__AVR128DA48__
in the definitions (I added it to the board in my modified platform)
Processing AVR128DA48 (platform: avr128da; board: curiosity_nano_da; framework: arduino; lib_deps: file://C:\Users\rafae\global_packages\Hola_LED_AVR128_MCHP_MCC-0.0.7.tar.gz)
----------------------------------------------------------------------------------------------
CONFIGURATION: https://docs.platformio.org/page/boards/avr128da/curiosity_nano_da.html
PLATFORM: AVR 128DA MCU Platform (0.0.3) (file://C:\Users\rafae\OneDrive\Documents\platform-avr128da) > Curiosity Nano AVR128DA48
HARDWARE: AVR128DA48 24MHz, 16KB RAM, 128KB Flash
PACKAGES:
- framework-arduino-megaavr-dxcore @ 1.4.10
- toolchain-atmelavr @ 3.70300.220127 (7.3.0)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 18 compatible libraries
Scanning dependencies...
Dependency Graph
|-- Hola_LED_AVR128_MCHP_MCC @ 0.0.7 (License: Apache-2.0, URI: file://C:\Users\rafae\global_packages\Hola_LED_AVR128_MCHP_MCC-0.0.7.tar.gz, Path: C:\Users\rafae\OneDrive\Documents\PIO_ws\blink_led_test_mod_platform\.pio\libdeps\AVR128DA48\Hola_LED_AVR128_MCHP_MCC)
Building in release mode
avr-gcc -o .pio\build\AVR128DA48\libdb0\Hola_LED_AVR128_MCHP_MCC\mcc_generated_files\system\src\clock.c.o -c -std=gnu11 -fno-fat-lto-objects -std=c99 -mmcu=avr128da48 -Os -w -ffunction-sections -fdata-sections -flto -mrelax -DPLATFORMIO=60105 -DARDUINO_AVR_AVR128DA48 -DARDUINO_avrda -DLED_BUILTIN=PIN_PC6 -D__AVR128DA48__ -DF_CPU=24000000L -DARDUINO_ARCH_MEGAAVR -DARDUINO=10808 -DCLOCK_SOURCE=0 -DDXCORE=\"1.4.10\" -DDXCORE_MAJOR=1UL -DDXCORE_MINOR=4UL -DDXCORE_PATCH=10UL -DDXCORE_RELEASED=1 -DCORE_ATTACH_ALL -DTWI_MORS_SINGLE -DMILLIS_USE_TIMERB2 -I.pio\libdeps\AVR128DA48\Hola_LED_AVR128_MCHP_MCC -I.pio\libdeps\AVR128DA48\Hola_LED_AVR128_MCHP_MCC\src -IC:\Users\rafae\.platformio\packages\framework-arduino-megaavr-dxcore\cores\dxcore\api\deprecated -IC:\Users\rafae\.platformio\packages\framework-arduino-megaavr-dxcore\cores\dxcore -IC:\Users\rafae\.platformio\packages\framework-arduino-megaavr-dxcore\variants\48pin-standard .pio\libdeps\AVR128DA48\Hola_LED_AVR128_MCHP_MCC\src\mcc_generated_files\system\src\clock.c
avr-gcc -o .pio\build\AVR128DA48\libdb0\Hola_LED_AVR128_MCHP_MCC\mcc_generated_files\system\src\config_bits.c.o -c -std=gnu11 -fno-fat-lto-objects -std=c99 -mmcu=avr128da48 -Os -w -ffunction-sections -fdata-sections -flto -mrelax -DPLATFORMIO=60105 -DARDUINO_AVR_AVR128DA48 -DARDUINO_avrda -DLED_BUILTIN=PIN_PC6 -D__AVR128DA48__ -DF_CPU=24000000L -DARDUINO_ARCH_MEGAAVR -DARDUINO=10808 -DCLOCK_SOURCE=0 -DDXCORE=\"1.4.10\" -DDXCORE_MAJOR=1UL -DDXCORE_MINOR=4UL -DDXCORE_PATCH=10UL -DDXCORE_RELEASED=1 -DCORE_ATTACH_ALL -DTWI_MORS_SINGLE -DMILLIS_USE_TIMERB2 -I.pio\libdeps\AVR128DA48\Hola_LED_AVR128_MCHP_MCC -I.pio\libdeps\AVR128DA48\Hola_LED_AVR128_MCHP_MCC\src -IC:\Users\rafae\.platformio\packages\framework-arduino-megaavr-dxcore\cores\dxcore\api\deprecated -IC:\Users\rafae\.platformio\packages\framework-arduino-megaavr-dxcore\cores\dxcore -IC:\Users\rafae\.platformio\packages\framework-arduino-megaavr-dxcore\variants\48pin-standard .pio\libdeps\AVR128DA48\Hola_LED_AVR128_MCHP_MCC\src\mcc_generated_files\system\src\config_bits.c
avr-gcc -o .pio\build\AVR128DA48\libdb0\Hola_LED_AVR128_MCHP_MCC\mcc_generated_files\system\src\interrupt.c.o -c -std=gnu11 -fno-fat-lto-objects -std=c99 -mmcu=avr128da48 -Os -w -ffunction-sections -fdata-sections -flto -mrelax -DPLATFORMIO=60105 -DARDUINO_AVR_AVR128DA48 -DARDUINO_avrda -DLED_BUILTIN=PIN_PC6 -D__AVR128DA48__ -DF_CPU=24000000L -DARDUINO_ARCH_MEGAAVR -DARDUINO=10808 -DCLOCK_SOURCE=0 -DDXCORE=\"1.4.10\" -DDXCORE_MAJOR=1UL -DDXCORE_MINOR=4UL -DDXCORE_PATCH=10UL -DDXCORE_RELEASED=1 -DCORE_ATTACH_ALL -DTWI_MORS_SINGLE -DMILLIS_USE_TIMERB2 -I.pio\libdeps\AVR128DA48\Hola_LED_AVR128_MCHP_MCC -I.pio\libdeps\AVR128DA48\Hola_LED_AVR128_MCHP_MCC\src -IC:\Users\rafae\.platformio\packages\framework-arduino-megaavr-dxcore\cores\dxcore\api\deprecated -IC:\Users\rafae\.platformio\packages\framework-arduino-megaavr-dxcore\cores\dxcore -IC:\Users\rafae\.platformio\packages\framework-arduino-megaavr-dxcore\variants\48pin-standard .pio\libdeps\AVR128DA48\Hola_LED_AVR128_MCHP_MCC\src\mcc_generated_files\system\src\interrupt.c
avr-gcc -o .pio\build\AVR128DA48\libdb0\Hola_LED_AVR128_MCHP_MCC\mcc_generated_files\system\src\pins.c.o -c -std=gnu11 -fno-fat-lto-objects -std=c99 -mmcu=avr128da48 -Os -w -ffunction-sections -fdata-sections -flto -mrelax -DPLATFORMIO=60105 -DARDUINO_AVR_AVR128DA48 -DARDUINO_avrda -DLED_BUILTIN=PIN_PC6 -D__AVR128DA48__ -DF_CPU=24000000L -DARDUINO_ARCH_MEGAAVR -DARDUINO=10808 -DCLOCK_SOURCE=0 -DDXCORE=\"1.4.10\" -DDXCORE_MAJOR=1UL -DDXCORE_MINOR=4UL -DDXCORE_PATCH=10UL -DDXCORE_RELEASED=1 -DCORE_ATTACH_ALL -DTWI_MORS_SINGLE -DMILLIS_USE_TIMERB2 -I.pio\libdeps\AVR128DA48\Hola_LED_AVR128_MCHP_MCC -I.pio\libdeps\AVR128DA48\Hola_LED_AVR128_MCHP_MCC\src -IC:\Users\rafae\.platformio\packages\framework-arduino-megaavr-dxcore\cores\dxcore\api\deprecated -IC:\Users\rafae\.platformio\packages\framework-arduino-megaavr-dxcore\cores\dxcore -IC:\Users\rafae\.platformio\packages\framework-arduino-megaavr-dxcore\variants\48pin-standard .pio\libdeps\AVR128DA48\Hola_LED_AVR128_MCHP_MCC\src\mcc_generated_files\system\src\pins.c
.pio\libdeps\AVR128DA48\Hola_LED_AVR128_MCHP_MCC\src\mcc_generated_files\system\src\pins.c: In function '__vector_29':
.pio\libdeps\AVR128DA48\Hola_LED_AVR128_MCHP_MCC\src\mcc_generated_files\system\src\pins.c:152:26: error: 'PORT_INT6_bm' undeclared (first use in this function); did you mean 'PORT_ISC2_bm'?
if(VPORTC.INTFLAGS & PORT_INT6_bm)
^~~~~~~~~~~~
PORT_ISC2_bm
.pio\libdeps\AVR128DA48\Hola_LED_AVR128_MCHP_MCC\src\mcc_generated_files\system\src\pins.c:152:26: note: each undeclared identifier is reported only once for each function it appears in
*** [.pio\build\AVR128DA48\libdb0\Hola_LED_AVR128_MCHP_MCC\mcc_generated_files\system\src\pins.c.o] Error 1
================================= [FAILED] Took 3.24 seconds =================================
The error persists, and since PORT_INT6_bm
and it’s definition live in ioavr128da48.h
(which gets installed in theXC8 <root_of_installation>\Microchip\xc8\v2.40\dfp\xc8\avr\include\avr
), I included that file into the library build.flags
:
"flags": "-std=c99 -include include/ioavr128da48.h",
But then I have an unexpected error instead (which I have seen before in other cases where the inculsion directories are wrongly configured, but could be other reason)
# error "Include <avr/io.h> instead of this file."
Because avr/io.h
is included in the system/utils/compiler.h
within that library
, and the order in which the functions are included suggests that the inclusions should happen in the correct sequence, I started thinking, that may be the order in which those files are being compiled is not correct?, do I need to specify dependencies between them somehow?
For the test’s sake, I added the places where avr/io.h
and ioavr128da48.h.h
are, as -I
in the library’s build.flags (as the -D earlier)
The original paths were something like this:
<Installation base>/Microchip/xc8/v2.40/avr/lib/gcc/avr/5.4.0/include
<Installation base>/Microchip/xc8/v2.40/dfp/xc8/avr/include/avr
<Installation base>/Microchip/xc8/v2.40/avr/avr/include/avr
Then I copied them into a directory path that doesn’t have the ‘space’ that ‘Program Files’ does, so they ended up as one string:
Processing AVR128DA48 (platform: avr128da; board: curiosity_nano_da; framework: arduino; lib_deps: file://C:\Users\rafae\global_packages\Hola_LED_AVR128_MCHP_MCC-0.0.7.tar.gz)
----------------------------------------------------------------------------------------------
CONFIGURATION: https://docs.platformio.org/page/boards/avr128da/curiosity_nano_da.html
PLATFORM: AVR 128DA MCU Platform (0.0.3) (file://C:\Users\rafae\OneDrive\Documents\platform-avr128da) > Curiosity Nano AVR128DA48
HARDWARE: AVR128DA48 24MHz, 16KB RAM, 128KB Flash
PACKAGES:
- framework-arduino-megaavr-dxcore @ 1.4.10
- toolchain-atmelavr @ 3.70300.220127 (7.3.0)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 18 compatible libraries
Scanning dependencies...
Dependency Graph
|-- Hola_LED_AVR128_MCHP_MCC @ 0.0.7 (License: Apache-2.0, URI: file://C:\Users\rafae\global_packages\Hola_LED_AVR128_MCHP_MCC-0.0.7.tar.gz, Path: C:\Users\rafae\OneDrive\Documents\PIO_ws\blink_led_test_mod_platform\.pio\libdeps\AVR128DA48\Hola_LED_AVR128_MCHP_MCC)
Building in release mode
avr-gcc -o .pio\build\AVR128DA48\libdb0\Hola_LED_AVR128_MCHP_MCC\mcc_generated_files\system\src\pins.c.o -c -std=gnu11 -fno-fat-lto-objects -std=c99 -mmcu=avr128da48 -Os -w -ffunction-sections -fdata-sections -flto -mrelax -DPLATFORMIO=60105 -DARDUINO_AVR_AVR128DA48 -DARDUINO_avrda -DLED_BUILTIN=PIN_PC6 -D__AVR128DA48__ -DF_CPU=24000000L -DARDUINO_ARCH_MEGAAVR -DARDUINO=10808 -DCLOCK_SOURCE=0 -DDXCORE=\"1.4.10\" -DDXCORE_MAJOR=1UL -DDXCORE_MINOR=4UL -DDXCORE_PATCH=10UL -DDXCORE_RELEASED=1 -DCORE_ATTACH_ALL -DTWI_MORS_SINGLE -DMILLIS_USE_TIMERB2 -I.pio\libdeps\AVR128DA48\Hola_LED_AVR128_MCHP_MCC -I.pio\libdeps\AVR128DA48\Hola_LED_AVR128_MCHP_MCC\src -IC:\Users\rafae\.platformio\packages\framework-arduino-megaavr-dxcore\cores\dxcore\api\deprecated -IC:\Users\rafae\.platformio\packages\framework-arduino-megaavr-dxcore\cores\dxcore -IC:\Users\rafae\.platformio\packages\framework-arduino-megaavr-dxcore\variants\48pin-standard -IC:\tmp\gcc_avr_5.4.0_include -IC:\tmp\dfp_xc8_avr_include -IC:\tmp\avr_include .pio\libdeps\AVR128DA48\Hola_LED_AVR128_MCHP_MCC\src\mcc_generated_files\system\src\pins.c
.pio\libdeps\AVR128DA48\Hola_LED_AVR128_MCHP_MCC\src\mcc_generated_files\system\src\pins.c: In function '__vector_29':
.pio\libdeps\AVR128DA48\Hola_LED_AVR128_MCHP_MCC\src\mcc_generated_files\system\src\pins.c:152:26: error: 'PORT_INT6_bm' undeclared (first use in this function); did you mean 'PORT_ISC2_bm'?
if(VPORTC.INTFLAGS & PORT_INT6_bm)
^~~~~~~~~~~~
PORT_ISC2_bm
.pio\libdeps\AVR128DA48\Hola_LED_AVR128_MCHP_MCC\src\mcc_generated_files\system\src\pins.c:152:26: note: each undeclared identifier is reported only once for each function it appears in
*** [.pio\build\AVR128DA48\libdb0\Hola_LED_AVR128_MCHP_MCC\mcc_generated_files\system\src\pins.c.o] Error 1
================================= [FAILED] Took 2.03 seconds =================================
Thanks for all your help