diff --git a/crc32/Makefile b/crc32/Makefile index 7b7ed10..2f05384 100644 --- a/crc32/Makefile +++ b/crc32/Makefile @@ -1,8 +1,9 @@ # Makefile -- sign32 -# Copyright (c) 2021 Renaud Fivet +# Copyright (c) 2021-2025 Renaud Fivet # silence unused parameter warning WARNINGS=-pedantic -Wall -Wextra -Wstrict-prototypes -Wno-unused-parameter CFLAGS = $(WARNINGS) -O2 +LDFLAGS = -s all: sign32 diff --git a/dht11main.c b/dht11main.c index 3137730..b769dd0 100644 --- a/dht11main.c +++ b/dht11main.c @@ -1,12 +1,12 @@ /* dht11main.c -- sample DHT11 sensor */ -/* Copyright (c) 2020-2021 Renaud Fivet */ +/* Copyright (c) 2020-2023 Renaud Fivet */ #include #include "system.h" #include "dht11.h" int main( void) { - static unsigned last ; + unsigned last = 0 ; dht11_init() ; for( ;;) @@ -17,7 +17,8 @@ int main( void) { if( 2 == (last % 5)) /* every 5 seconds starting 2s after boot */ switch( dht11_read()) { case DHT11_SUCCESS: - printf( "%u%%RH, %d.%uC\n", dht11_humid, dht11_tempc, dht11_tempf) ; + printf( "%u%%RH, %d.%uC\n", dht11_humid, dht11_tempc, + dht11_tempf) ; break ; case DHT11_FAIL_TOUT: puts( "Timeout") ; diff --git a/docs/25_prototype.html b/docs/25_prototype.html index e0f5dc3..1eb66e6 100644 --- a/docs/25_prototype.html +++ b/docs/25_prototype.html @@ -71,7 +71,7 @@ void kputu( unsigned u) { } int main( void) { - static unsigned last ; + unsigned last = 0 ; for( ;;) if( last != uptime) { diff --git a/docs/26_uptime.html b/docs/26_uptime.html index 8ee60b6..c50ee50 100644 --- a/docs/26_uptime.html +++ b/docs/26_uptime.html @@ -195,7 +195,7 @@ static void display( unsigned u, const char *s) { } int main( void) { - static unsigned last ; + unsigned last = 0 ; for( ;;) if( last != uptime) { @@ -284,7 +284,7 @@ The build now complete successfully. $ make f030f4.elf text data bss dec hex filename - 1325 0 12 1337 539 f030f4.elf + 1317 0 8 1325 52d f030f4.elf f030f4.hex f030f4.bin diff --git a/docs/27_library.html b/docs/27_library.html index ff68812..67b216d 100644 --- a/docs/27_library.html +++ b/docs/27_library.html @@ -88,7 +88,7 @@ Build terminates successfully producing the same executable as before. $ make f030f4.elf from startup.o uplow.2.o uptime.o text data bss dec hex filename - 1325 0 12 1337 539 f030f4.elf + 1317 0 8 1325 52d f030f4.elf f030f4.hex f030f4.bin diff --git a/docs/28_clocks.html b/docs/28_clocks.html index c112bab..f5adc29 100644 --- a/docs/28_clocks.html +++ b/docs/28_clocks.html @@ -310,7 +310,7 @@ Build complete successfully, this is for PLL HSE board configuration. $ make f030f4.elf from startup.o clocks.o uptime.o text data bss dec hex filename - 1441 0 12 1453 5ad f030f4.elf + 1433 0 8 1441 5a1 f030f4.elf f030f4.hex f030f4.bin diff --git a/docs/29_interrupt.html b/docs/29_interrupt.html index 67ad248..26e42c9 100644 --- a/docs/29_interrupt.html +++ b/docs/29_interrupt.html @@ -246,7 +246,7 @@ Build completes successfully $ make f030f4.elf from startup.txeie.o txeie.o uptime.o text data bss dec hex filename - 1641 0 20 1661 67d f030f4.elf + 1633 0 16 1649 671 f030f4.elf f030f4.hex f030f4.bin diff --git a/docs/31_dht11.html b/docs/31_dht11.html index ce441c6..87dbae7 100644 --- a/docs/31_dht11.html +++ b/docs/31_dht11.html @@ -220,7 +220,7 @@ Based on this API, I write dht11main.c. #include "dht11.h" int main() { - static unsigned last ; + unsigned last = 0 ; dht11_init() ; for( ;;) @@ -408,7 +408,7 @@ Build completes successfully $ make f030f4.elf from startup.txeie.o gpioa.o dht11main.o dht11.o text data bss dec hex filename - 1877 0 24 1901 76d f030f4.elf + 1861 0 20 1881 759 f030f4.elf f030f4.hex f030f4.bin @@ -429,6 +429,6 @@ can read the values reported by the DHT11 sensor. Next, I will investigate if the values read are correct. -
© 2020-2024 Renaud Fivet +
© 2020-2025 Renaud Fivet diff --git a/docs/34_adcvnt.html b/docs/34_adcvnt.html index f9330ad..8960ac5 100644 --- a/docs/34_adcvnt.html +++ b/docs/34_adcvnt.html @@ -340,7 +340,7 @@ adc.c:232:3: warning: #warning HCLK is not multiple of 8 MHz [-Wcpp] | ^~~~~~~ f030f4.elf from startup.txeie.o adc.o adcmain.o text data bss dec hex filename - 2464 0 16 2480 9b0 f030f4.elf + 2408 0 16 2424 978 f030f4.elf f030f4.hex f030f4.bin @@ -366,6 +366,6 @@ point measured in factory for the STM32F030 family members. means taking two measurements as far apart as possible in the working range I want to use. -
© 2020-2024 Renaud Fivet +
© 2020-2025 Renaud Fivet diff --git a/docs/36_update.html b/docs/36_update.html index 839f1ab..cb4e19b 100644 --- a/docs/36_update.html +++ b/docs/36_update.html @@ -130,7 +130,7 @@ environment in use (Cygwin, MSYS2 and other). ifeq (linux, $(findstring linux, $(MAKE_HOST))) INSTALLDIR = $(HOME)/Packages #REVDIR = gcc-arm-none-eabi-10-2020-q4-major - REVDIR = arm-gnu-toolchain-13.3.rel1-x86_64-arm-none-eabi + REVDIR = arm-gnu-toolchain-14.2.rel1-x86_64-arm-none-eabi else DRIVE = d ifeq (cygwin, $(findstring cygwin, $(MAKE_HOST))) @@ -142,7 +142,7 @@ else endif INSTALLDIR = $(OSDRIVE)/Program Files (x86) #REVDIR = GNU Arm Embedded Toolchain/10 2020-q4-major - REVDIR = GNU Arm Embedded Toolchain/arm-gnu-toolchain-13.3.rel1-mingw-w64-i686-arm-none-eabi + REVDIR = GNU Arm Embedded Toolchain/arm-gnu-toolchain-14.2.rel1-mingw-w64-i686-arm-none-eabi endif GCCDIR = $(INSTALLDIR)/$(REVDIR) @@ -174,6 +174,6 @@ changes. Next, I will (re)build to execute code in RAM instead of FLASH. -
© 2020-2024 Renaud Fivet +
© 2020-2025 Renaud Fivet diff --git a/docs/37_inram.html b/docs/37_inram.html index 1a301ed..ca24992 100644 --- a/docs/37_inram.html +++ b/docs/37_inram.html @@ -384,7 +384,7 @@ ledtick.elf: ledtick.o cstartup.elf: cstartup.o %.elf: - @echo $@ + @echo $@ from $+ $(CC) $(CPU) -T$(LD_SCRIPT) $(LDFLAGS) -nostartfiles -o $@ $+ $(SIZE) $@ $(OBJDUMP) -hS $@ > $(subst .elf,.lst,$@) @@ -397,15 +397,26 @@ The projects composition need to be updated to use the new startup. Finally, to keep track of the memory model and the load location, I put the load address in the name of the binary file generated. -
all: $(PROJECT).$(BINLOC).bin $(PROJECT).hex
+
all: $(PROJECT).hex $(PROJECT).$(BINLOC).bin
+ +With the corresponding rule + +
+%.$(BINLOC).bin: %.elf
+    @echo $@
+    $(OBJCOPY) -O binary $< $@
+
This way if I build uptime prototype in GORAM memory model
 $ make
-f030f4.elf
+f030f4.elf from startup.ram.o txeie.o uptime.1.o libstm32.a
+Memory region         Used Size  Region Size  %age Used
+           FLASH:        1163 B         2 KB     56.79%
+             RAM:         208 B         2 KB     10.16%
    text    data     bss     dec     hex filename
-   1164       0      20    1184     4a0 f030f4.elf
+   1163       0     208    1371     55b f030f4.elf
 f030f4.hex
 f030f4.0x20000800.bin
 
@@ -419,19 +430,18 @@ $ stm32flash -g 0x20000800

Caveat: stm32flash v0.6 intel hex bug

-At the time of writing, stm32flash v0.6 has a bug that prevents -writing intel hex files correctly at address other than the origin of -the Flash. A bug fix and the possibility to directly read the base -address from the intel hex file are planned to be included in v0.7. +stm32flash v0.6 had a bug that prevents writing intel hex files +correctly at address other than the origin of the Flash. A bug fix and the +possibility to directly read the base address from the intel hex file was +merged in v0.7.

-Until v0.7 is out, I am using my own patched version of stm32flash or -the binary files when I need to test GOFLASH and GORAM memory models. -

-As I branched off my own patched version of stm32flash, I added a +I have branched off my own patched version of stm32flash, I added a -x option to write and execute an intel hex file:

stm32flash -x file.hex COM#
+This patch is scheduled to be merged in v0.8. +

Testing

I build all four memory models and check that they can be loaded and @@ -448,6 +458,6 @@ GORAM with STM32 Cube Programmer. Next, I will add integrity check at startup by doing CRC32 validation of the code. -
© 2020-2024 Renaud Fivet +
© 2020-2025 Renaud Fivet diff --git a/uptime.1.c b/uptime.1.c index 1b351c2..357026f 100644 --- a/uptime.1.c +++ b/uptime.1.c @@ -1,5 +1,5 @@ /* uptime.1.c -- tells how long the system has been running -** Copyright (c) 2020 Renaud Fivet +** Copyright (c) 2020-2023 Renaud Fivet ** ** v1 displays the number of seconds elapsed since boot */ @@ -19,7 +19,7 @@ void kputu( unsigned u) { } int main( void) { - static unsigned last ; + unsigned last = 0 ; for( ;;) if( last != uptime) { diff --git a/uptime.c b/uptime.c index 1b8e8fe..14e8302 100644 --- a/uptime.c +++ b/uptime.c @@ -1,5 +1,5 @@ /* uptime.c -- tells how long the system has been running */ -/* Copyright (c) 2020 Renaud Fivet */ +/* Copyright (c) 2020-2023 Renaud Fivet */ #include #include "system.h" /* uptime, yield() */