@glyn.hudson - you still need to gnu99 flag as well and even with your new settings there is still an issue on Pi. All the console output in this post is one session, I have chopped it up only for the purpose of adding notes and hopefully making it more digestible.
I last had this running last night (confirmed compile and flash using PIO) and I have not changed anything in the interim. First off, I did not expect it to need to re download the toolchain, what should have been a simple recompile of last nights code took ages.
pi@raspberrypi:~/redo/txshield_demo_3/emonTxshield $ pio run -t upload [Mon Mar 26 18:57:32 2018] Processing stm32f303 (platform: ststm32; board: nucleo_f303re; framework: stm32cube)
--------------------------------------------------------------------------------
PlatformManager: Installing ststm32
Downloading [####################################] 100%
Unpacking [####################################] 100%
ststm32 @ 4.1.0 has been successfully installed!
The platform 'ststm32' has been successfully installed!
The rest of packages will be installed automatically depending on your build environment.
PackageManager: Installing tool-stm32duino @ ~1.0.0
Downloading [####################################] 100%
Unpacking [####################################] 100%
PackageManager: Installing toolchain-gccarmnoneeabi @ >=1.60301.0
Downloading [####################################] 100%
Unpacking [####################################] 100%
PackageManager: Installing tool-stlink @ ~1.10400.0
Downloading [####################################] 100%
Unpacking [####################################] 100%
PackageManager: Installing tool-openocd @ ~1.1000.0
Downloading [####################################] 100%
Unpacking [####################################] 100%
PackageManager: Installing framework-stm32cube @ ~1.1.0
Downloading [####################################] 100%
Unpacking [####################################] 100%
CorePackageManager: Installing tool-scons @ ~2.20501.4
Downloading [####################################] 100%
Unpacking [####################################] 100%
tool-scons @ 2.20501.4 has been successfully installed!
Verbose mode can be enabled via `-v, --verbose` option
PLATFORM: ST STM32 > ST Nucleo F303RE
SYSTEM: STM32F303RET6 72MHz 64KB RAM (512KB Flash)
DEBUG: CURRENT(stlink) ON-BOARD(stlink) EXTERNAL(blackmagic, jlink)
Warning! Cannot find a linker script for the required board! Firmware will be linked with a default linker script!
Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF MODES: FINDER(chain) COMPATIBILITY(light)
Collected 0 compatible libraries
Scanning dependencies...
No dependencies
*** [.pioenvs/stm32f303/firmware.elf] /home/pi/redo/txshield_demo_3/emonTxshield/.pioenvs/stm32f303/firmware.elf: Permission denied
IOError: [Errno 13] Permission denied: '/home/pi/redo/txshield_demo_3/emonTxshield/.pioenvs/.sconsign.tmp':
File "/home/pi/.platformio/packages/tool-scons/script/../engine/SCons/Script/Main.py", line 1346:
_exec_main(parser, values)
File "/home/pi/.platformio/packages/tool-scons/script/../engine/SCons/Script/Main.py", line 1309:
_main(parser)
File "/home/pi/.platformio/packages/tool-scons/script/../engine/SCons/Script/Main.py", line 1091:
nodes = _build_targets(fs, options, targets, target_top)
File "/home/pi/.platformio/packages/tool-scons/script/../engine/SCons/Script/Main.py", line 1283:
jobs.run(postfunc = jobs_postfunc)
File "/home/pi/.platformio/packages/tool-scons/script/../engine/SCons/Job.py", line 113:
postfunc()
File "/home/pi/.platformio/packages/tool-scons/script/../engine/SCons/Script/Main.py", line 1280:
SCons.SConsign.write()
File "/home/pi/.platformio/packages/tool-scons/script/../engine/SCons/SConsign.py", line 109:
syncmethod()
File "/home/pi/.platformio/packages/tool-scons/script/../engine/SCons/dblite.py", line 118:
f = self._open(self._tmp_name, "wb", self._mode)
Exception IOError: (13, 'Permission denied', '/home/pi/redo/txshield_demo_3/emonTxshield/.pioenvs/.sconsign.tmp') in <bound method dblite.__del__ of <SCons.dblite.dblite object at 0x75a37b90>> ignored
========================= [ERROR] Took 449.62 seconds =========================
8 minutes is a long time, anyway, it failed to compile and I wasnât sure why so I just ran it again (just ârunâ without âuploadâ) and this time it has given me a better description of the error and what to do about it.
pi@raspberrypi:~/redo/txshield_demo_3/emonTxshield $ pio run
Please manually remove file `/home/pi/redo/txshield_demo_3/emonTxshield/.pioenvs/structure.hash`
Can not remove temporary directory `/home/pi/redo/txshield_demo_3/emonTxshield/.pioenvs`. Please remove it manually to avoid build issues
[Mon Mar 26 19:05:14 2018] Processing stm32f303-dev (platform: ststm32; board: nucleo_f303re; framework: stm32cube)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
PLATFORM: ST STM32 > ST Nucleo F303RE
SYSTEM: STM32F303RET6 72MHz 64KB RAM (512KB Flash)
DEBUG: CURRENT(stlink) ON-BOARD(stlink) EXTERNAL(blackmagic, jlink)
Warning! Cannot find a linker script for the required board! Firmware will be linked with a default linker script!
Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF MODES: FINDER(chain) COMPATIBILITY(light)
Collected 0 compatible libraries
Scanning dependencies...
No dependencies
*** [.pioenvs/stm32f303-dev] /home/pi/redo/txshield_demo_3/emonTxshield/.pioenvs/stm32f303-dev: Permission denied
IOError: [Errno 13] Permission denied: '/home/pi/redo/txshield_demo_3/emonTxshield/.pioenvs/.sconsign.tmp':
File "/home/pi/.platformio/packages/tool-scons/script/../engine/SCons/Script/Main.py", line 1346:
_exec_main(parser, values)
File "/home/pi/.platformio/packages/tool-scons/script/../engine/SCons/Script/Main.py", line 1309:
_main(parser)
File "/home/pi/.platformio/packages/tool-scons/script/../engine/SCons/Script/Main.py", line 1091:
nodes = _build_targets(fs, options, targets, target_top)
File "/home/pi/.platformio/packages/tool-scons/script/../engine/SCons/Script/Main.py", line 1283:
jobs.run(postfunc = jobs_postfunc)
File "/home/pi/.platformio/packages/tool-scons/script/../engine/SCons/Job.py", line 113:
postfunc()
File "/home/pi/.platformio/packages/tool-scons/script/../engine/SCons/Script/Main.py", line 1280:
SCons.SConsign.write()
File "/home/pi/.platformio/packages/tool-scons/script/../engine/SCons/SConsign.py", line 109:
syncmethod()
File "/home/pi/.platformio/packages/tool-scons/script/../engine/SCons/dblite.py", line 118:
f = self._open(self._tmp_name, "wb", self._mode)
Exception IOError: (13, 'Permission denied', '/home/pi/redo/txshield_demo_3/emonTxshield/.pioenvs/.sconsign.tmp') in <bound method dblite.__del__ of <SCons.dblite.dblite object at 0x7599e2d0>> ignored
========================== [ERROR] Took 8.58 seconds ==========================
It seems to have a problem deleting some temp files and it asks me to do it manually, which I do and then run ârunâ again.
pi@raspberrypi:~/redo/txshield_demo_3/emonTxshield $ sudo rm -r /home/pi/redo/txshield_demo_3/emonTxshield/.pioenvs
pi@raspberrypi:~/redo/txshield_demo_3/emonTxshield $ pio run
[Mon Mar 26 19:06:39 2018] Processing stm32f303-dev (platform: ststm32; board: nucleo_f303re; framework: stm32cube)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
PLATFORM: ST STM32 > ST Nucleo F303RE
SYSTEM: STM32F303RET6 72MHz 64KB RAM (512KB Flash)
DEBUG: CURRENT(stlink) ON-BOARD(stlink) EXTERNAL(blackmagic, jlink)
Warning! Cannot find a linker script for the required board! Firmware will be linked with a default linker script!
Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF MODES: FINDER(chain) COMPATIBILITY(light)
Collected 0 compatible libraries
Scanning dependencies...
No dependencies
Compiling .pioenvs/stm32f303-dev/src/adc.o
Compiling .pioenvs/stm32f303-dev/src/dma.o
Compiling .pioenvs/stm32f303-dev/src/gpio.o
Compiling .pioenvs/stm32f303-dev/src/main.o
Src/adc.c: In function 'ConvCpltEither':
Src/adc.c:641:5: error: 'for' loop initial declarations are only allowed in C99 mode
for (int i=0; i<SEQS_PER_HALF; i++) {
^
Src/adc.c:641:5: note: use option -std=c99 or -std=gnu99 to compile your code
*** [.pioenvs/stm32f303-dev/src/adc.o] Error 1
========================== [ERROR] Took 10.86 seconds ==========================
This time it gets a bit further but I see the same error we were getting a couple of days ago telling us to use the gnu99 flag that dBC has included in the Makefile extension .mak
file. So at this point I add build_flags = -std=gnu99
to the end of your platformio.ini and try again.
pi@raspberrypi:~/redo/txshield_demo_3/emonTxshield $ nano platformio.ini
pi@raspberrypi:~/redo/txshield_demo_3/emonTxshield $ pio run
[Mon Mar 26 19:07:37 2018] Processing stm32f303-dev (platform: ststm32; board: nucleo_f303re; framework: stm32cube)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
PLATFORM: ST STM32 > ST Nucleo F303RE
SYSTEM: STM32F303RET6 72MHz 64KB RAM (512KB Flash)
DEBUG: CURRENT(stlink) ON-BOARD(stlink) EXTERNAL(blackmagic, jlink)
Warning! Cannot find a linker script for the required board! Firmware will be linked with a default linker script!
Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF MODES: FINDER(chain) COMPATIBILITY(light)
Collected 0 compatible libraries
Scanning dependencies...
No dependencies
Compiling .pioenvs/stm32f303-dev/src/adc.o
Compiling .pioenvs/stm32f303-dev/src/dma.o
Compiling .pioenvs/stm32f303-dev/src/gpio.o
Compiling .pioenvs/stm32f303-dev/src/main.o
Compiling .pioenvs/stm32f303-dev/src/power.o
Compiling .pioenvs/stm32f303-dev/src/stm32f3xx_hal_msp.o
Compiling .pioenvs/stm32f303-dev/src/stm32f3xx_it.o
Compiling .pioenvs/stm32f303-dev/src/system_stm32f3xx.o
Compiling .pioenvs/stm32f303-dev/src/tim.o
Compiling .pioenvs/stm32f303-dev/src/usart.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_adc.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_adc_ex.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_can.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_cec.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_comp.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_cortex.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_crc.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_crc_ex.o
/home/pi/.platformio/packages/framework-stm32cube/f3/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_crc.c: In function 'CRC_Handle_8':
/home/pi/.platformio/packages/framework-stm32cube/f3/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_crc.c:485:8: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
*(uint16_t volatile*) (&hcrc->Instance->DR) = ((uint32_t)pBuffer[4*i]<<8) | (uint32_t)pBuffer[4*i+1];
^
/home/pi/.platformio/packages/framework-stm32cube/f3/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_crc.c:489:8: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
*(uint16_t volatile*) (&hcrc->Instance->DR) = ((uint32_t)pBuffer[4*i]<<8) | (uint32_t)pBuffer[4*i+1];
^
/home/pi/.platformio/packages/framework-stm32cube/f3/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_crc.c: In function 'CRC_Handle_16':
/home/pi/.platformio/packages/framework-stm32cube/f3/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_crc.c:521:8: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
*(uint16_t volatile*) (&hcrc->Instance->DR) = pBuffer[2*i];
^
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_dac.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_dac_ex.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_dma.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_flash.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_flash_ex.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_gpio.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_hrtim.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_i2c.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_i2c_ex.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_i2s.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_i2s_ex.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_irda.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_iwdg.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_nand.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_nor.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_opamp.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_opamp_ex.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_pccard.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_pcd.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_pcd_ex.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_pwr.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_pwr_ex.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_rcc.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_rcc_ex.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_rtc.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_rtc_ex.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_sdadc.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_smartcard.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_smartcard_ex.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_smbus.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_spi.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_spi_ex.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_sram.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_tim.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_tim_ex.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_tsc.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_uart.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_uart_ex.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_usart.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_wwdg.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_ll_adc.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_ll_comp.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_ll_crc.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_ll_dac.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_ll_dma.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_ll_exti.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_ll_fmc.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_ll_gpio.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_ll_hrtim.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_ll_i2c.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_ll_opamp.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_ll_pwr.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_ll_rcc.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_ll_rtc.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_ll_spi.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_ll_tim.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_ll_usart.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_ll_utils.o
Compiling .pioenvs/stm32f303-dev/FrameworkCMSISDevice/gcc/startup_stm32f303xe.o
Compiling .pioenvs/stm32f303-dev/FrameworkCMSISDevice/system_stm32f3xx.o
Archiving .pioenvs/stm32f303-dev/libFrameworkCMSISDevice.a
Indexing .pioenvs/stm32f303-dev/libFrameworkCMSISDevice.a
Archiving .pioenvs/stm32f303-dev/libFrameworkHALDriver.a
Indexing .pioenvs/stm32f303-dev/libFrameworkHALDriver.a
Linking .pioenvs/stm32f303-dev/firmware.elf
Calculating size .pioenvs/stm32f303-dev/firmware.elf
text data bss dec hex filename
20636 1088 5904 27628 6bec .pioenvs/stm32f303-dev/firmware.elf
Building .pioenvs/stm32f303-dev/firmware.bin
========================= [SUCCESS] Took 41.07 seconds =========================
a couple of warnings but it compiles ok, To confirm my findings I re-edited the platformio.ini by commenting out the âgnu99â line and ran ârunâ again.
pi@raspberrypi:~/redo/txshield_demo_3/emonTxshield $ nano platformio.ini
pi@raspberrypi:~/redo/txshield_demo_3/emonTxshield $ pio run
[Mon Mar 26 19:10:53 2018] Processing stm32f303-dev (platform: ststm32; board: nucleo_f303re; framework: stm32cube)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
PLATFORM: ST STM32 > ST Nucleo F303RE
SYSTEM: STM32F303RET6 72MHz 64KB RAM (512KB Flash)
DEBUG: CURRENT(stlink) ON-BOARD(stlink) EXTERNAL(blackmagic, jlink)
Warning! Cannot find a linker script for the required board! Firmware will be linked with a default linker script!
Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF MODES: FINDER(chain) COMPATIBILITY(light)
Collected 0 compatible libraries
Scanning dependencies...
No dependencies
Compiling .pioenvs/stm32f303-dev/src/adc.o
Compiling .pioenvs/stm32f303-dev/src/dma.o
Compiling .pioenvs/stm32f303-dev/src/gpio.o
Compiling .pioenvs/stm32f303-dev/src/main.o
Src/adc.c: In function 'ConvCpltEither':
Src/adc.c:641:5: error: 'for' loop initial declarations are only allowed in C99 mode
for (int i=0; i<SEQS_PER_HALF; i++) {
^
Src/adc.c:641:5: note: use option -std=c99 or -std=gnu99 to compile your code
*** [.pioenvs/stm32f303-dev/src/adc.o] Error 1
========================== [ERROR] Took 10.14 seconds ==========================
It failed with the same error again, I tried it again, this time with run and upload (shouldnât be different I know, but you never know)
pi@raspberrypi:~/redo/txshield_demo_3/emonTxshield $ pio run -t upload [Mon Mar 26 19:11:49 2018] Processing stm32f303-dev (platform: ststm32; board: nucleo_f303re; framework: stm32cube)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
PLATFORM: ST STM32 > ST Nucleo F303RE
SYSTEM: STM32F303RET6 72MHz 64KB RAM (512KB Flash)
DEBUG: CURRENT(stlink) ON-BOARD(stlink) EXTERNAL(blackmagic, jlink)
Warning! Cannot find a linker script for the required board! Firmware will be linked with a default linker script!
Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF MODES: FINDER(chain) COMPATIBILITY(light)
Collected 0 compatible libraries
Scanning dependencies...
No dependencies
Compiling .pioenvs/stm32f303-dev/src/adc.o
Compiling .pioenvs/stm32f303-dev/src/power.o
Compiling .pioenvs/stm32f303-dev/src/stm32f3xx_hal_msp.o
Compiling .pioenvs/stm32f303-dev/src/stm32f3xx_it.o
Src/adc.c: In function 'ConvCpltEither':
Src/adc.c:641:5: error: 'for' loop initial declarations are only allowed in C99 mode
for (int i=0; i<SEQS_PER_HALF; i++) {
^
Src/adc.c:641:5: note: use option -std=c99 or -std=gnu99 to compile your code
*** [.pioenvs/stm32f303-dev/src/adc.o] Error 1
Src/power.c: In function 'process_power_data':
Src/power.c:79:3: error: 'for' loop initial declarations are only allowed in C99 mode
for (int chan=0; chan<MAX_CHANNELS; chan++)
^
Src/power.c:79:3: note: use option -std=c99 or -std=gnu99 to compile your code
*** [.pioenvs/stm32f303-dev/src/power.o] Error 1
========================== [ERROR] Took 11.76 seconds ==========================
No change it failed again so I uncommented the gnu99 line and tried once more.
pi@raspberrypi:~/redo/txshield_demo_3/emonTxshield $ nano platformio.ini
pi@raspberrypi:~/redo/txshield_demo_3/emonTxshield $ pio run -t upload
[Mon Mar 26 19:12:28 2018] Processing stm32f303-dev (platform: ststm32; board: nucleo_f303re; framework: stm32cube)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
PLATFORM: ST STM32 > ST Nucleo F303RE
SYSTEM: STM32F303RET6 72MHz 64KB RAM (512KB Flash)
DEBUG: CURRENT(stlink) ON-BOARD(stlink) EXTERNAL(blackmagic, jlink)
Warning! Cannot find a linker script for the required board! Firmware will be linked with a default linker script!
Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF MODES: FINDER(chain) COMPATIBILITY(light)
Collected 0 compatible libraries
Scanning dependencies...
No dependencies
Compiling .pioenvs/stm32f303-dev/src/adc.o
Compiling .pioenvs/stm32f303-dev/src/dma.o
Compiling .pioenvs/stm32f303-dev/src/gpio.o
Compiling .pioenvs/stm32f303-dev/src/main.o
Compiling .pioenvs/stm32f303-dev/src/power.o
Compiling .pioenvs/stm32f303-dev/src/stm32f3xx_hal_msp.o
Compiling .pioenvs/stm32f303-dev/src/stm32f3xx_it.o
Compiling .pioenvs/stm32f303-dev/src/system_stm32f3xx.o
Compiling .pioenvs/stm32f303-dev/src/tim.o
Compiling .pioenvs/stm32f303-dev/src/usart.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_adc.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_adc_ex.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_can.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_cec.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_comp.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_cortex.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_crc.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_crc_ex.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_dac.o
/home/pi/.platformio/packages/framework-stm32cube/f3/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_crc.c: In function 'CRC_Handle_8':
/home/pi/.platformio/packages/framework-stm32cube/f3/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_crc.c:485:8: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
*(uint16_t volatile*) (&hcrc->Instance->DR) = ((uint32_t)pBuffer[4*i]<<8) | (uint32_t)pBuffer[4*i+1];
^
/home/pi/.platformio/packages/framework-stm32cube/f3/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_crc.c:489:8: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
*(uint16_t volatile*) (&hcrc->Instance->DR) = ((uint32_t)pBuffer[4*i]<<8) | (uint32_t)pBuffer[4*i+1];
^
/home/pi/.platformio/packages/framework-stm32cube/f3/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_crc.c: In function 'CRC_Handle_16':
/home/pi/.platformio/packages/framework-stm32cube/f3/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_crc.c:521:8: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
*(uint16_t volatile*) (&hcrc->Instance->DR) = pBuffer[2*i];
^
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_dac_ex.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_dma.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_flash.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_flash_ex.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_gpio.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_hrtim.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_i2c.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_i2c_ex.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_i2s.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_i2s_ex.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_irda.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_iwdg.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_nand.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_nor.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_opamp.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_opamp_ex.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_pccard.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_pcd.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_pcd_ex.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_pwr.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_pwr_ex.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_rcc.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_rcc_ex.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_rtc.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_rtc_ex.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_sdadc.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_smartcard.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_smartcard_ex.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_smbus.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_spi.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_spi_ex.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_sram.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_tim.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_tim_ex.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_tsc.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_uart.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_uart_ex.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_usart.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_hal_wwdg.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_ll_adc.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_ll_comp.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_ll_crc.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_ll_dac.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_ll_dma.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_ll_exti.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_ll_fmc.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_ll_gpio.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_ll_hrtim.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_ll_i2c.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_ll_opamp.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_ll_pwr.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_ll_rcc.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_ll_rtc.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_ll_spi.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_ll_tim.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_ll_usart.o
Compiling .pioenvs/stm32f303-dev/FrameworkHALDriver/Src/stm32f3xx_ll_utils.o
Compiling .pioenvs/stm32f303-dev/FrameworkCMSISDevice/gcc/startup_stm32f303xe.o
Compiling .pioenvs/stm32f303-dev/FrameworkCMSISDevice/system_stm32f3xx.o
Archiving .pioenvs/stm32f303-dev/libFrameworkCMSISDevice.a
Indexing .pioenvs/stm32f303-dev/libFrameworkCMSISDevice.a
Archiving .pioenvs/stm32f303-dev/libFrameworkHALDriver.a
Indexing .pioenvs/stm32f303-dev/libFrameworkHALDriver.a
Linking .pioenvs/stm32f303-dev/firmware.elf
Checking program size
text data bss dec hex filename
20636 1088 5904 27628 6bec .pioenvs/stm32f303-dev/firmware.elf
Building .pioenvs/stm32f303-dev/firmware.bin
Configuring upload protocol...
AVAILABLE: blackmagic, jlink, mbed, mbed, stlink
CURRENT: upload_protocol = mbed
Looking for upload disk...
Auto-detected: /media/pi/NODE_F303RE
Uploading .pioenvs/stm32f303-dev/firmware.bin
Firmware has been successfully uploaded.
(Some boards may require manual hard reset)
========================= [SUCCESS] Took 42.20 seconds =========================
a couple of warnings but it compiled ok, as the âuploadâ command was used this time it had installed to my stm32 but when I checked the serial output it is without data
pi@raspberrypi:~/redo/txshield_demo_3/emonTxshield $ pio device monitor
--- Miniterm on /dev/ttyACM0 115200,8,N,1 ---
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
2: Vrms: , Irms: , Papp: , Preal: , PF:
3: Vrms: , Irms: , Papp: , Preal: , PF:
0: Vrms: , Irms: , Papp: , Preal: , PF:
1: Vrms: , Irms: , Papp: , Preal: , PF:
3: Vrms: , Irms: , Papp: , Preal: , PF:
0: Vrms: , Irms: , Papp: , Preal: , PF:
1: Vrms: , Irms: , Papp: , Preal: , PF:
2: Vrms: , Irms: , Papp: , Preal: , PF:
0: Vrms: , Irms: , Papp: , Preal: , PF:
1: Vrms: , Irms: , Papp: , Preal: , PF:
2: Vrms: , Irms: , Papp: , Preal: , PF:
3: Vrms: , Irms: , Papp: , Preal: , PF:
--- exit ---
my current platformio.ini file is
pi@raspberrypi:~/redo/txshield_demo_3/emonTxshield $ cat platformio.ini
[platformio]
src_dir = Src
include_dir = Inc
env_default = stm32f303-dev
[common]
# Specify flags/variables commmon to all enviroments
# PlatfomIO common variables docs: http://docs.platformio.org/en/latest/projectconf/dynamic_variables.html
# PlatfomIO build_flags docs: http://docs.platformio.org/en/latest/projectconf/section_env_build.html
debug_flags = -D DEBUG=1
build_flags = -Wl,-u_printf_float
monitor_baud = 115200
# Dev build enviroment (default)
# $ pio run -t upload
[env:stm32f303-dev]
platform = ststm32
framework = stm32cube
board = nucleo_f303re
monitor_baud = ${common.monitor_baud}
build_flags = -std=gnu99
This isnât a emonSD, itâs a Pi3 with the March 18 Raspbian Stretch and only the minicom and Arm toolchain packages installed plus PIO via the âquick installâ method.
I might try v5 later tonight but I expect the same results, if you have any ideaâs or further flags I should try, let me know, but it is unlikely I will re install PIO when I re-flash this sdcard to test installing the minimal arm toolchain plus minicom installation method from a fresh image.