STM32 Development

Actually it could be easier

sudo apt-get install -y gcc-arm-none-eabi

saves you having to press “y” to confirm to install :smile:

But yes you are right that’s why I was spitting bullets the other day after trying and failing several complex guides multiple times. It just isn’t that complicated. I’m glad to hear you’ve got that sorted now, I feel your pain.

2 Likes

Where does sudo apt-get install gcc-arm-none-eabi, install the toolchain for you? what do you put in the makefile? I had this working with the download binary directly from arm https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads approach but interested to test the sudo apt-get approach

It’s installed in /usr/bin by default.
The makefile is generated by CubeMX

Paul

The binaries seem to be in /usr/bin

pi@raspberrypi:~/emonTxshield $ ls -la /usr/bin/arm-none-eabi*
-rwxr-xr-x 1 root root  652692 Oct 28  2016 /usr/bin/arm-none-eabi-addr2line
-rwxr-xr-x 2 root root  673120 Oct 28  2016 /usr/bin/arm-none-eabi-ar
-rwxr-xr-x 2 root root 1146792 Oct 28  2016 /usr/bin/arm-none-eabi-as
-rwxr-xr-x 2 root root  704640 Oct 14  2016 /usr/bin/arm-none-eabi-c++
-rwxr-xr-x 1 root root  652500 Oct 28  2016 /usr/bin/arm-none-eabi-c++filt
-rwxr-xr-x 1 root root  704640 Oct 14  2016 /usr/bin/arm-none-eabi-cpp
-rwxr-xr-x 1 root root   22328 Oct 28  2016 /usr/bin/arm-none-eabi-elfedit
-rwxr-xr-x 2 root root  704640 Oct 14  2016 /usr/bin/arm-none-eabi-g++
-rwxr-xr-x 2 root root  704640 Oct 14  2016 /usr/bin/arm-none-eabi-gcc
-rwxr-xr-x 2 root root  704640 Oct 14  2016 /usr/bin/arm-none-eabi-gcc-5.4.1
-rwxr-xr-x 1 root root   26368 Oct 14  2016 /usr/bin/arm-none-eabi-gcc-ar
-rwxr-xr-x 1 root root   26368 Oct 14  2016 /usr/bin/arm-none-eabi-gcc-nm
-rwxr-xr-x 1 root root   26368 Oct 14  2016 /usr/bin/arm-none-eabi-gcc-ranlib
-rwxr-xr-x 1 root root  399944 Oct 14  2016 /usr/bin/arm-none-eabi-gcov
-rwxr-xr-x 1 root root  367172 Oct 14  2016 /usr/bin/arm-none-eabi-gcov-tool
-rwxr-xr-x 1 root root  714812 Oct 28  2016 /usr/bin/arm-none-eabi-gprof
-rwxr-xr-x 4 root root  984784 Oct 28  2016 /usr/bin/arm-none-eabi-ld
-rwxr-xr-x 4 root root  984784 Oct 28  2016 /usr/bin/arm-none-eabi-ld.bfd
-rwxr-xr-x 2 root root  661220 Oct 28  2016 /usr/bin/arm-none-eabi-nm
-rwxr-xr-x 2 root root  810188 Oct 28  2016 /usr/bin/arm-none-eabi-objcopy
-rwxr-xr-x 2 root root 1028356 Oct 28  2016 /usr/bin/arm-none-eabi-objdump
-rwxr-xr-x 2 root root  673128 Oct 28  2016 /usr/bin/arm-none-eabi-ranlib
-rwxr-xr-x 2 root root  419492 Oct 28  2016 /usr/bin/arm-none-eabi-readelf
-rwxr-xr-x 1 root root  652636 Oct 28  2016 /usr/bin/arm-none-eabi-size
-rwxr-xr-x 1 root root  652692 Oct 28  2016 /usr/bin/arm-none-eabi-strings
-rwxr-xr-x 2 root root  810196 Oct 28  2016 /usr/bin/arm-none-eabi-strip
pi@raspberrypi:~/emonTxshield $ ls -la /usr/lib/arm-none-eabi
total 20
drwxr-xr-x  5 root root 4096 Mar 22 17:47 .
drwxr-xr-x 83 root root 4096 Mar 22 17:45 ..
drwxr-xr-x  2 root root 4096 Mar 22 17:45 bin
lrwxrwxrwx  1 root root   43 Mar 22 17:47 include -> /etc/alternatives/gcc-arm-none-eabi-include
drwxr-xr-x  2 root root 4096 Mar 22 17:45 ldscripts
lrwxrwxrwx  1 root root   39 Mar 22 17:47 lib -> /etc/alternatives/gcc-arm-none-eabi-lib
drwxr-xr-x  8 root root 4096 Mar 22 17:47 newlib

but although it in in the users PATH

pi@raspberrypi:~/emonTxshield $ arm-none-eabi-gcc --version
arm-none-eabi-gcc (15:5.4.1+svn241155-1) 5.4.1 20160919
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

it seem dBC’s BINPATH fix is required to get the other options in there to compile rather than just editing Makefile

perfect, compiles fine, much simpler than downloading the binaries from arm, thanks!

1 Like

What I did was:

  1. Throw away my first attempt at the tutorial.
  2. Start from the top, setting up the ADC etc in STM32CubeMX
  3. Stopped at the end of post 38 with the changes to the Makefile, and hit Make.

The Makefile lists, under ‘paths’:
Application/User/Src/adc.c and twice under ‘C sources’: Src/adc.c
[presumably the same, but I can’t see where the mapping “Application/User” is done, and nowhere do I have a “Application” directory]

[Question: Why are files listed under “paths”? I smell a problem.]

Under ‘C sources’ it lists:
Src/gpio.c twice
Src/dma.c twice
Src/usart.c twice
Src/main.c twice

Peculiarly, I don’t get multiple definitions when I have gpio.c, usart.c dma.c or main.c twice, it’s only adc.c that triggers the multiple definitions errors.

I was looking at the Makefile for emonTxshield and comparing the two, to try to spot where the multiple definitions were coming from, and thought I’d better prove it was OK first. Wrong!


Having got V3... If I run make on the untouched unzipped version, it compiles OK up to: make: *** No rule to make target 'build/startup_stm32f303xe.o', needed by 'build/emonTxshield.elf'. Stop.

It appears from the list of object files in .map that that’s the only one it couldn’t/didn’t compile.

When I went back to the .ioc file and did “Generate Code”, it complained that my version of STM ws later than yours, @dBC.

Me too! - so my toolchain is OK too.
Mine complained about ‘strlen’

hmm… I think most of these problems have been caused by me being selective about what I put in the tarfile… not sure why I did that, but it’s clearly not a good idea. This time I’ve gone up one layer into the Projects directory and made a complete tar of emonTxshield. Hopefully this will sort it: txshield_demo_4.tar.gz (810.9 KB)

Guess I better bring mine up to date then… not something I ever look forward to for fear I too will end up in the same tools hell the rest of you are in :frowning:

hmm… I seem to get a completely clean build with no warnings, which is what I always aim for. Can you tell which file it’s trying to compile when you get the strlen warning?

Src/usart.c:128

That’s very strange. And your usart.c includes <string.h>? Mine’s quite clean:

$ touch Src/usart.c 
$ make
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/usart.d" -MT"build/usart.d" -std=gnu99 -Wa,-a,-ad,-alms=build/usart.lst Src/usart.c -o build/usart.o
/usr/bin/arm-none-eabi-gcc build/adc.o build/power.o build/stm32f3xx_hal_msp.o build/stm32f3xx_hal_uart.o build/stm32f3xx_hal_adc_ex.o build/stm32f3xx_hal_adc.o build/stm32f3xx_hal_tim.o build/stm32f3xx_hal_gpio.o build/usart.o build/stm32f3xx_hal_rcc_ex.o build/gpio.o build/stm32f3xx_hal_i2c.o build/stm32f3xx_hal_pwr.o build/stm32f3xx_hal_flash_ex.o build/stm32f3xx_hal_cortex.o build/main.o build/stm32f3xx_it.o build/stm32f3xx_hal_dma.o build/system_stm32f3xx.o build/dma.o build/stm32f3xx_hal_tim_ex.o build/tim.o build/stm32f3xx_hal_uart_ex.o build/stm32f3xx_hal_rcc.o build/stm32f3xx_hal_flash.o build/stm32f3xx_hal_pwr_ex.o build/stm32f3xx_hal.o build/stm32f3xx_hal_i2c_ex.o build/startup_stm32f303xe.o -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -specs=nano.specs -TSTM32F303RETx_FLASH.ld  -lc -lm -lnosys  -Wl,-Map=build/emonTxshield.map,--cref -Wl,--gc-sections -Xlinker --no-wchar-size-warning -u _printf_float -o build/emonTxshield.elf
/usr/bin/arm-none-eabi-size build/emonTxshield.elf
   text	   data	    bss	    dec	    hex	filename
  27576	    172	   5908	  33656	   8378	build/emonTxshield.elf
/usr/bin/arm-none-eabi-objcopy -O ihex build/emonTxshield.elf build/emonTxshield.hex
/usr/bin/arm-none-eabi-objcopy -O binary -S build/emonTxshield.elf build/emonTxshield.bin	
$

I think you’re looking at different projects. Robert is looking at my “stm32tests/stm32test1” which is my copy of the original tutorial, and you are looking at the “emonTxshield” presumably v4.

I have just recompiled my “stm32tests/stm32test1” which Robert is getting the strlen warning and this is the full print

pi@raspberrypi:~/emonTxshield $ make
mkdir build
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/adc.d" -MT"build/adc.d" -std=gnu99 -Wa,-a,-ad,-alms=build/adc.lst Src/adc.c -o build/adc.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/power.d" -MT"build/power.d" -std=gnu99 -Wa,-a,-ad,-alms=build/power.lst Src/power.c -o build/power.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_msp.d" -MT"build/stm32f3xx_hal_msp.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_msp.lst Src/stm32f3xx_hal_msp.c -o build/stm32f3xx_hal_msp.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_uart.d" -MT"build/stm32f3xx_hal_uart.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_uart.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_uart.c -o build/stm32f3xx_hal_uart.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_adc_ex.d" -MT"build/stm32f3xx_hal_adc_ex.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_adc_ex.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_adc_ex.c -o build/stm32f3xx_hal_adc_ex.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_adc.d" -MT"build/stm32f3xx_hal_adc.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_adc.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_adc.c -o build/stm32f3xx_hal_adc.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_tim.d" -MT"build/stm32f3xx_hal_tim.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_tim.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_tim.c -o build/stm32f3xx_hal_tim.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_gpio.d" -MT"build/stm32f3xx_hal_gpio.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_gpio.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_gpio.c -o build/stm32f3xx_hal_gpio.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/usart.d" -MT"build/usart.d" -std=gnu99 -Wa,-a,-ad,-alms=build/usart.lst Src/usart.c -o build/usart.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_rcc_ex.d" -MT"build/stm32f3xx_hal_rcc_ex.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_rcc_ex.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_rcc_ex.c -o build/stm32f3xx_hal_rcc_ex.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/gpio.d" -MT"build/gpio.d" -std=gnu99 -Wa,-a,-ad,-alms=build/gpio.lst Src/gpio.c -o build/gpio.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_i2c.d" -MT"build/stm32f3xx_hal_i2c.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_i2c.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_i2c.c -o build/stm32f3xx_hal_i2c.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_pwr.d" -MT"build/stm32f3xx_hal_pwr.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_pwr.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_pwr.c -o build/stm32f3xx_hal_pwr.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_flash_ex.d" -MT"build/stm32f3xx_hal_flash_ex.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_flash_ex.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_flash_ex.c -o build/stm32f3xx_hal_flash_ex.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_cortex.d" -MT"build/stm32f3xx_hal_cortex.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_cortex.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_cortex.c -o build/stm32f3xx_hal_cortex.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/main.d" -MT"build/main.d" -std=gnu99 -Wa,-a,-ad,-alms=build/main.lst Src/main.c -o build/main.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_it.d" -MT"build/stm32f3xx_it.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_it.lst Src/stm32f3xx_it.c -o build/stm32f3xx_it.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_dma.d" -MT"build/stm32f3xx_hal_dma.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_dma.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_dma.c -o build/stm32f3xx_hal_dma.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/system_stm32f3xx.d" -MT"build/system_stm32f3xx.d" -std=gnu99 -Wa,-a,-ad,-alms=build/system_stm32f3xx.lst Src/system_stm32f3xx.c -o build/system_stm32f3xx.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/dma.d" -MT"build/dma.d" -std=gnu99 -Wa,-a,-ad,-alms=build/dma.lst Src/dma.c -o build/dma.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_tim_ex.d" -MT"build/stm32f3xx_hal_tim_ex.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_tim_ex.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_tim_ex.c -o build/stm32f3xx_hal_tim_ex.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/tim.d" -MT"build/tim.d" -std=gnu99 -Wa,-a,-ad,-alms=build/tim.lst Src/tim.c -o build/tim.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_uart_ex.d" -MT"build/stm32f3xx_hal_uart_ex.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_uart_ex.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_uart_ex.c -o build/stm32f3xx_hal_uart_ex.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_rcc.d" -MT"build/stm32f3xx_hal_rcc.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_rcc.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_rcc.c -o build/stm32f3xx_hal_rcc.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_flash.d" -MT"build/stm32f3xx_hal_flash.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_flash.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_flash.c -o build/stm32f3xx_hal_flash.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_pwr_ex.d" -MT"build/stm32f3xx_hal_pwr_ex.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_pwr_ex.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_pwr_ex.c -o build/stm32f3xx_hal_pwr_ex.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal.d" -MT"build/stm32f3xx_hal.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal.c -o build/stm32f3xx_hal.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_i2c_ex.d" -MT"build/stm32f3xx_hal_i2c_ex.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_i2c_ex.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_i2c_ex.c -o build/stm32f3xx_hal_i2c_ex.o
make: *** No rule to make target 'build/startup_stm32f303xe.o', needed by 'build/emonTxshield.elf'.  Stop.
pi@raspberrypi:~/emonTxshield $ cd ../stm32tests/stm32test1
pi@raspberrypi:~/stm32tests/stm32test1 $ make
make: Nothing to be done for 'all'.
pi@raspberrypi:~/stm32tests/stm32test1 $ make clean
rm -fR .dep build
pi@raspberrypi:~/stm32tests/stm32test1 $ make
mkdir build
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_uart.d" -MT"build/stm32f3xx_hal_uart.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_uart.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_uart.c -o build/stm32f3xx_hal_uart.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/main.d" -MT"build/main.d" -std=gnu99 -Wa,-a,-ad,-alms=build/main.lst Src/main.c -o build/main.o
Src/main.c: In function 'main':
Src/main.c:110:3: warning: implicit declaration of function 'debug_printf' [-Wimplicit-function-declaration]
   debug_printf(log_buffer);
   ^
Src/main.c:111:3: warning: implicit declaration of function 'calibrate_ADC2' [-Wimplicit-function-declaration]
   calibrate_ADC2();
   ^
Src/main.c:112:3: warning: implicit declaration of function 'start_ADC2' [-Wimplicit-function-declaration]
   start_ADC2();
   ^
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal.d" -MT"build/stm32f3xx_hal.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal.c -o build/stm32f3xx_hal.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_pwr_ex.d" -MT"build/stm32f3xx_hal_pwr_ex.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_pwr_ex.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_pwr_ex.c -o build/stm32f3xx_hal_pwr_ex.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_i2c_ex.d" -MT"build/stm32f3xx_hal_i2c_ex.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_i2c_ex.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_i2c_ex.c -o build/stm32f3xx_hal_i2c_ex.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_cortex.d" -MT"build/stm32f3xx_hal_cortex.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_cortex.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_cortex.c -o build/stm32f3xx_hal_cortex.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_msp.d" -MT"build/stm32f3xx_hal_msp.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_msp.lst Src/stm32f3xx_hal_msp.c -o build/stm32f3xx_hal_msp.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_pwr.d" -MT"build/stm32f3xx_hal_pwr.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_pwr.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_pwr.c -o build/stm32f3xx_hal_pwr.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_flash.d" -MT"build/stm32f3xx_hal_flash.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_flash.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_flash.c -o build/stm32f3xx_hal_flash.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_tim.d" -MT"build/stm32f3xx_hal_tim.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_tim.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_tim.c -o build/stm32f3xx_hal_tim.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_it.d" -MT"build/stm32f3xx_it.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_it.lst Src/stm32f3xx_it.c -o build/stm32f3xx_it.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_flash_ex.d" -MT"build/stm32f3xx_hal_flash_ex.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_flash_ex.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_flash_ex.c -o build/stm32f3xx_hal_flash_ex.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_uart_ex.d" -MT"build/stm32f3xx_hal_uart_ex.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_uart_ex.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_uart_ex.c -o build/stm32f3xx_hal_uart_ex.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_dma.d" -MT"build/stm32f3xx_hal_dma.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_dma.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_dma.c -o build/stm32f3xx_hal_dma.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_rcc.d" -MT"build/stm32f3xx_hal_rcc.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_rcc.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_rcc.c -o build/stm32f3xx_hal_rcc.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_rcc_ex.d" -MT"build/stm32f3xx_hal_rcc_ex.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_rcc_ex.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_rcc_ex.c -o build/stm32f3xx_hal_rcc_ex.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_gpio.d" -MT"build/stm32f3xx_hal_gpio.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_gpio.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_gpio.c -o build/stm32f3xx_hal_gpio.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_i2c.d" -MT"build/stm32f3xx_hal_i2c.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_i2c.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_i2c.c -o build/stm32f3xx_hal_i2c.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/system_stm32f3xx.d" -MT"build/system_stm32f3xx.d" -std=gnu99 -Wa,-a,-ad,-alms=build/system_stm32f3xx.lst Src/system_stm32f3xx.c -o build/system_stm32f3xx.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_tim_ex.d" -MT"build/stm32f3xx_hal_tim_ex.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_tim_ex.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_tim_ex.c -o build/stm32f3xx_hal_tim_ex.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/usart.d" -MT"build/usart.d" -std=gnu99 -Wa,-a,-ad,-alms=build/usart.lst Src/usart.c -o build/usart.o
Src/usart.c: In function 'debug_printf':
Src/usart.c:128:43: warning: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
   HAL_UART_Transmit(&huart2, (uint8_t*)p, strlen(p), 1000);
                                           ^
Src/usart.c:128:43: warning: incompatible implicit declaration of built-in function 'strlen'
Src/usart.c:128:43: note: include '<string.h>' or provide a declaration of 'strlen'
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/gpio.d" -MT"build/gpio.d" -std=gnu99 -Wa,-a,-ad,-alms=build/gpio.lst Src/gpio.c -o build/gpio.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_adc.d" -MT"build/stm32f3xx_hal_adc.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_adc.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_adc.c -o build/stm32f3xx_hal_adc.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_adc_ex.d" -MT"build/stm32f3xx_hal_adc_ex.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_adc_ex.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_adc_ex.c -o build/stm32f3xx_hal_adc_ex.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/adc.d" -MT"build/adc.d" -std=gnu99 -Wa,-a,-ad,-alms=build/adc.lst Src/adc.c -o build/adc.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/dma.d" -MT"build/dma.d" -std=gnu99 -Wa,-a,-ad,-alms=build/dma.lst Src/dma.c -o build/dma.o
/usr/bin/arm-none-eabi-gcc -x assembler-with-cpp -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/startup_stm32f303xe.d" -MT"build/startup_stm32f303xe.d" -std=gnu99 startup_stm32f303xe.s -o build/startup_stm32f303xe.o
/usr/bin/arm-none-eabi-gcc build/stm32f3xx_hal_uart.o build/main.o build/stm32f3xx_hal.o build/stm32f3xx_hal_pwr_ex.o build/stm32f3xx_hal_i2c_ex.o build/stm32f3xx_hal_cortex.o build/stm32f3xx_hal_msp.o build/stm32f3xx_hal_pwr.o build/stm32f3xx_hal_flash.o build/stm32f3xx_hal_tim.o build/stm32f3xx_it.o build/stm32f3xx_hal_flash_ex.o build/stm32f3xx_hal_uart_ex.o build/stm32f3xx_hal_dma.o build/stm32f3xx_hal_rcc.o build/stm32f3xx_hal_rcc_ex.o build/stm32f3xx_hal_gpio.o build/stm32f3xx_hal_i2c.o build/system_stm32f3xx.o build/stm32f3xx_hal_tim_ex.o build/usart.o build/gpio.o build/stm32f3xx_hal_adc.o build/stm32f3xx_hal_adc_ex.o build/adc.o build/dma.o build/startup_stm32f303xe.o -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -specs=nano.specs -TSTM32F303RETx_FLASH.ld  -lc -lm -lnosys  -Wl,-Map=build/stm32test1.map,--cref -Wl,--gc-sections -Xlinker --no-wchar-size-warning -o build/stm32test1.elf
/usr/bin/arm-none-eabi-size build/stm32test1.elf
   text    data     bss     dec     hex filename
  11256      12    4948   16216    3f58 build/stm32test1.elf
/usr/bin/arm-none-eabi-objcopy -O ihex build/stm32test1.elf build/stm32test1.hex
/usr/bin/arm-none-eabi-objcopy -O binary -S build/stm32test1.elf build/stm32test1.bin
pi@raspberrypi:~/stm32tests/stm32test1 $

here’s what Robert is compiling
stm32tests-master.zip (653.8 KB)

I do not get those errors with the emonTxshield_2 andemonTxshield_3 I haven’t tried _4 yet and _1 doesn’t compile.

Since I was missing a jumper to connect PA0 to PB14 and to help my learning process I’ve decided to build on the end of your 3. ADC Tutorial Part3, adding user code to make it useful. tutorial @dBC adding in some RMS voltage and current maths to see if I could get my head around it. I’ve stuck to 1 ADC and inputs A0 (Voltage) and A1 (CT1) for now and am getting good results :slight_smile:

rmscalc

These are the modifications I made from my last point showing the rms math https://github.com/TrystanLea/STM32Dev/commit/3b37aa5acdb2169fa835b9a8d956fd1a29f35221

Im using the shiftedFCL filter documented by @Robert.Wall in learn Learn | OpenEnergyMonitor and Im not doing any zero crossing detection to start/end the sampling period yet.

Now with a calculation of real power :slight_smile:
https://github.com/TrystanLea/STM32Dev/blob/master/STM02/Src/main.c

Cool. And to answer your question in the comment…

`ADC1_DMA_BUFFSIZE 4000    // must me integer multiple of number of channels?`

The practical answer is yes, it must be a multiple. If it’s not the DMA controller will still jump back to the beginning of the buffer when it gets to the end (so there’ll be no overrun into what lives past the buffer) but it will do that part way through the sequence. Once that happens, you’ll lose track of which channel buff[0] represents as it’ll change each time around.

On the multiple ADC front, I’ve made some progress on how to support negative (and 0) delays… currently the delays only go in one direction (Current ADCs start early, Voltage ADC starts late). Not quite there yet though, and then there’ll be a lot of scope testing to make sure they’re all kicking off on the correct edges.

1 Like

Thanks @dBC, that sounds great, looking forward to hearing more about how it develops.

I’ve now amended my test code to print out, Vrms, Irms, realPower, apparentPower and powerFactor as floats with the makefile modifications you mentioned.

BINPATH = /usr/bin
CFLAGS += -std=gnu99
LDFLAGS += -Xlinker --no-wchar-size-warning -u _printf_float

A much better way, as long as the bias/offset is stable, is like emonLibCM: remove the offset at the reporting stage. (Not that you’re worried about speeding up the calculation - but it does!)

Yes, I followed your lead on that in power.c and I agree it’s much better.

I’ve been thinking a bit about how to best approach 3 phase. ADC1 and ADC2 can each reach 7 input pins, while ADC3 and ADC4 can each reach 3 pins, so it might make sense to permanently devote ADC4 to Voltage measurements and let it continuously cycle through the 3 voltage measurements. That leaves 17 Current inputs spread across the other three.

Using the sequencer slots, I think we could have a lot of flexibility on assigning a Current input to a phase, i.e. it could be done at runtime (or config time) rather than hardwired at the factory. The simplest case is where the phases happen to end up well distributed across the 3 Current ADCs like this:
easy
In this diagram, C2.6 for example means channel 6 on ADC2, phase is indicated by colour. So you can choose C2.6’s phase simply by which slot you drop it into. When they’re well dispersed like in the above example it’s easy because there are slots to spare.

The more challenging case is where all the Red phase CTs happen to end up on ADC1, all the Yellow on ADC2 and all the Blue on ADC3. In that case we run out of slots and compromises have to be made:
congestion
We had to move one of the Reds to ADC2 and one of the Yellows to ADC1 and one of the Blues to ADC2. So it doesn’t give total flexibility, but apart from a few pathological cases, it comes pretty close.

I wonder if the 64 pin package is making things too awkward, the 144pin package would offer 40 adc channels to pick from. We don’t need to break them all out for to use the full 40 all at once, but it might give us the flexibility to have a wider variety of profiles, some physical inputs could be hardwired or jumpered to multiple adc’s.

There was also a question about using the F373 which has only 2 ADC’s (16bit) and 40 channels, as that might fit better with with what we’re doing. I haven’t looked at the F373 spec closely, but as long as there are at least 3 adc12 channels for the Vac, the configuration will be pretty easy as any CT channel can then be associated with any Vac channel.

If there’s not much in the pricing 64p v 144p or F303 v F373, we maybe making hard work for ourselves unnecessarily.