diff --git a/Makefile b/Makefile index 57d75fc..0d5ff62 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ # Makefile -- stm32bringup -# Copyright © 2020-2024 Renaud Fivet +# Copyright © 2020-2025 Renaud Fivet ### Build environment selection @@ -15,7 +15,8 @@ ifeq (linux, $(findstring linux, $(MAKE_HOST))) #REVDIR = arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi #REVDIR = arm-gnu-toolchain-12.2.mpacbti-rel1-x86_64-arm-none-eabi #REVDIR = arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi - REVDIR = arm-gnu-toolchain-13.3.rel1-x86_64-arm-none-eabi +#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))) @@ -40,7 +41,8 @@ endif #REVDIR = GNU Arm Embedded Toolchain/arm-gnu-toolchain-12.2.rel1-mingw-w64-i686-arm-none-eabi #REVDIR = GNU Arm Embedded Toolchain/arm-gnu-toolchain-12.2.mpacbti-rel1-mingw-w64-i686-arm-none-eabi #REVDIR = GNU Arm Embedded Toolchain/arm-gnu-toolchain-13.2.Rel1-mingw-w64-i686-arm-none-eabi - 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-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) diff --git a/docs/11_toolchain.html b/docs/11_toolchain.html index d12de28..663f4a2 100644 --- a/docs/11_toolchain.html +++ b/docs/11_toolchain.html @@ -27,10 +27,10 @@ IDE or encapsulate those paths and names in Makefile variables.
 ### Build environment selection
 
-GCCDIR = "D:/Program Files (x86)/GNU Arm Embedded Toolchain/arm-gnu-toolchain-13.3.rel1-mingw-w64-i686-arm-none-eabi"
+GCCDIR = "D:/Program Files (x86)/GNU Arm Embedded Toolchain/arm-gnu-toolchain-14.2.rel1-mingw-w64-i686-arm-none-eabi"
 
-BINPFX  = $(GCCDIR)/bin/arm-none-eabi-
-CC      = $(BINPFX)gcc
+BINPFX = $(GCCDIR)/bin/arm-none-eabi-
+CC     = $(BINPFX)gcc
 
 ### Build rules
 
@@ -49,11 +49,11 @@ share the same name prefix arm-none-eabi-. So I have created a
 
 
 $ make
-"D:/Program Files (x86)/GNU Arm Embedded Toolchain/arm-gnu-toolchain-13.3.rel1-m
+"D:/Program Files (x86)/GNU Arm Embedded Toolchain/arm-gnu-toolchain-14.2.rel1-m
 ingw-w64-i686-arm-none-eabi"/bin/arm-none-eabi-gcc --version
-arm-none-eabi-gcc.exe (Arm GNU Toolchain 13.3.Rel1 (Build arm-13.24)) 13.3.1 202
-40614
-Copyright (C) 2023 Free Software Foundation, Inc.
+arm-none-eabi-gcc.exe (Arm GNU Toolchain 14.2.Rel1 (Build arm-14.52)) 14.2.1 202
+41119
+Copyright (C) 2024 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.
 
@@ -65,20 +65,20 @@ means that the Makefile on Linux will be the same as the Windows one except for the value of the GCCDIR variable.
-GCCDIR = $(HOME)/Packages/arm-gnu-toolchain-13.3.rel1-x86_64-arm-none-eabi
+GCCDIR = $(HOME)/Packages/arm-gnu-toolchain-14.2.rel1-x86_64-arm-none-eabi
 
By selecting the path based on the development environment, there is no need -to make changes while switching between OS. Gmake has the built-in +to make changes while switching between OS. gmake has the built-in variable MAKE_HOST that can be tested for this.
 ### Build environment selection
 
 ifeq (linux, $(findstring linux, $(MAKE_HOST)))
- GCCDIR = $(HOME)/Packages/arm-gnu-toolchain-13.3.rel1-x86_64-arm-none-eabi
+ GCCDIR = $(HOME)/Packages/arm-gnu-toolchain-14.2.rel1-x86_64-arm-none-eabi
 else
- GCCDIR = "D:/Program Files (x86)/GNU Arm Embedded Toolchain/arm-gnu-toolchain-13.3.rel1-mingw-w64-i686-arm-none-eabi"
+ GCCDIR = "D:/Program Files (x86)/GNU Arm Embedded Toolchain/arm-gnu-toolchain-14.2.rel1-mingw-w64-i686-arm-none-eabi"
 endif
 
 BINPFX  = $(GCCDIR)/bin/arm-none-eabi-
@@ -94,9 +94,9 @@ version:
 
I use the path prefix $(HOME)/Packages instead of ~/Packages when -defining GCCDIR as some sub-processes called by gmake may have -issues with ~ expansion (in this case ld). This way gmake -will handle the expansion before calling the sub-processes. +defining GCCDIR as some sub-processes called by gmake may +have issues with ~ expansion (in this case ld). This way +gmake will handle the expansion before calling the sub-processes.

Toolchain’s chain of events

In order to generate a file that can be loaded in the micro-controller, I @@ -109,7 +109,8 @@ executable (.elf) loading or flashing (.bin or .hex).

1. Compile

-Gmake has default rules to built .o files out of .c files. +gmake has default rules to built .o files out of .c +files. As I have already defined with CC the command to compile, I can make a simple test of this step by creating an empty .c file and checking what happens when I try to compile it. @@ -118,7 +119,7 @@ happens when I try to compile it. $ touch empty.c $ make empty.o -"D:/Program Files (x86)/GNU Arm Embedded Toolchain/arm-gnu-toolchain-13.3.rel1-m +"D:/Program Files (x86)/GNU Arm Embedded Toolchain/arm-gnu-toolchain-14.2.rel1-m ingw-w64-i686-arm-none-eabi"/bin/arm-none-eabi-gcc -c -o empty.o empty.c
Compilation is succesful and empty.o file is generated. @@ -139,9 +140,9 @@ use the simplest script: mem.ld. ### Build environment selection ifeq (linux, $(findstring linux, $(MAKE_HOST))) - GCCDIR = $(HOME)/Packages/arm-gnu-toolchain-13.3.rel1-x86_64-arm-none-eabi + GCCDIR = $(HOME)/Packages/arm-gnu-toolchain-14.2.rel1-x86_64-arm-none-eabi else - GCCDIR = "D:/Program Files (x86)/GNU Arm Embedded Toolchain/arm-gnu-toolchain-13.3.rel1-mingw-w64-i686-arm-none-eabi" + GCCDIR = "D:/Program Files (x86)/GNU Arm Embedded Toolchain/arm-gnu-toolchain-14.2.rel1-mingw-w64-i686-arm-none-eabi" endif BINPFX = $(GCCDIR)/bin/arm-none-eabi- @@ -152,6 +153,11 @@ LD_SCRIPT = $(GCCDIR)/share/gcc-arm-none-eabi/samples/ldscripts/mem.ld ### Build rules +.PHONY: version + +version: + $(CC) --version + %.elf: %.o $(LD) -T$(LD_SCRIPT) -o $@ $< @@ -159,23 +165,24 @@ LD_SCRIPT = $(GCCDIR)/share/gcc-arm-none-eabi/samples/ldscripts/mem.ld
 $ make empty.elf
-"D:/Program Files (x86)/GNU Arm Embedded Toolchain/arm-gnu-toolchain-13.3.rel1-m
+"D:/Program Files (x86)/GNU Arm Embedded Toolchain/arm-gnu-toolchain-14.2.rel1-m
 ingw-w64-i686-arm-none-eabi"/bin/arm-none-eabi-ld -T"D:/Program Files (x86)/GNU 
-Arm Embedded Toolchain/arm-gnu-toolchain-13.3.rel1-mingw-w64-i686-arm-none-eabi"
+Arm Embedded Toolchain/arm-gnu-toolchain-14.2.rel1-mingw-w64-i686-arm-none-eabi"
 /share/gcc-arm-none-eabi/samples/ldscripts/mem.ld -o empty.elf empty.o
 
Link terminates successfully and creates empty.elf.

3. Convert

-Finally, I use the command objcopy to convert the executable .elf -file into binary or intel hex format suitable to load in the micro-controller. +Finally, I use the command objcopy to convert the executable +.elf file into binary or intel hex format suitable to load in the +micro-controller.
 ### Build environment selection
 
 ifeq (linux, $(findstring linux, $(MAKE_HOST)))
- GCCDIR = $(HOME)/Packages/arm-gnu-toolchain-13.3.rel1-x86_64-arm-none-eabi
+ GCCDIR = $(HOME)/Packages/arm-gnu-toolchain-14.2.rel1-x86_64-arm-none-eabi
 else
- GCCDIR = "D:/Program Files (x86)/GNU Arm Embedded Toolchain/arm-gnu-toolchain-13.3.rel1-mingw-w64-i686-arm-none-eabi"
+ GCCDIR = "D:/Program Files (x86)/GNU Arm Embedded Toolchain/arm-gnu-toolchain-14.2.rel1-mingw-w64-i686-arm-none-eabi"
 endif
 
 BINPFX  = $(GCCDIR)/bin/arm-none-eabi-
@@ -187,6 +194,11 @@ LD_SCRIPT = $(GCCDIR)/share/gcc-arm-none-eabi/samples/ldscripts/mem.ld
 
 ### Build rules
 
+.PHONY: version
+
+version:
+    $(CC) --version
+
 %.elf: %.o
     $(LD) -T$(LD_SCRIPT) -o $@ $<
 
@@ -203,23 +215,23 @@ empty empty.c file, I can successfully build.
 
 
 $ make empty.bin empty.hex
-"D:/Program Files (x86)/GNU Arm Embedded Toolchain/arm-gnu-toolchain-13.3.rel1-m
+"D:/Program Files (x86)/GNU Arm Embedded Toolchain/arm-gnu-toolchain-14.2.rel1-m
 ingw-w64-i686-arm-none-eabi"/bin/arm-none-eabi-gcc    -c -o empty.o empty.c
-"D:/Program Files (x86)/GNU Arm Embedded Toolchain/arm-gnu-toolchain-13.3.rel1-m
+"D:/Program Files (x86)/GNU Arm Embedded Toolchain/arm-gnu-toolchain-14.2.rel1-m
 ingw-w64-i686-arm-none-eabi"/bin/arm-none-eabi-ld -T"D:/Program Files (x86)/GNU 
-Arm Embedded Toolchain/arm-gnu-toolchain-13.3.rel1-mingw-w64-i686-arm-none-eabi"
+Arm Embedded Toolchain/arm-gnu-toolchain-14.2.rel1-mingw-w64-i686-arm-none-eabi"
 /share/gcc-arm-none-eabi/samples/ldscripts/mem.ld -o empty.elf empty.o
-"D:/Program Files (x86)/GNU Arm Embedded Toolchain/arm-gnu-toolchain-13.3.rel1-m
+"D:/Program Files (x86)/GNU Arm Embedded Toolchain/arm-gnu-toolchain-14.2.rel1-m
 ingw-w64-i686-arm-none-eabi"/bin/arm-none-eabi-objcopy -O binary empty.elf empty
 .bin
-"D:/Program Files (x86)/GNU Arm Embedded Toolchain/arm-gnu-toolchain-13.3.rel1-m
+"D:/Program Files (x86)/GNU Arm Embedded Toolchain/arm-gnu-toolchain-14.2.rel1-m
 ingw-w64-i686-arm-none-eabi"/bin/arm-none-eabi-objcopy -O ihex empty.elf empty.h
 ex
 rm empty.o empty.elf
 
-Notice that gmake automatically removes the intermediary .o and -.elf files on completion. +Notice that gmake automatically removes the intermediary +.o and .elf files on completion.

The generated empty.bin is empty. @@ -229,7 +241,7 @@ of the long command names. Also I need a way to clean the working directory back to its initial state.

@@ -237,9 +249,9 @@ target in the rules helps to keep track of the build progression. ### Build environment selection ifeq (linux, $(findstring linux, $(MAKE_HOST))) - GCCDIR = $(HOME)/Packages/arm-gnu-toolchain-13.3.rel1-x86_64-arm-none-eabi + GCCDIR = $(HOME)/Packages/arm-gnu-toolchain-14.2.rel1-x86_64-arm-none-eabi else - GCCDIR = "D:/Program Files (x86)/GNU Arm Embedded Toolchain/arm-gnu-toolchain-13.3.rel1-mingw-w64-i686-arm-none-eabi" + GCCDIR = "D:/Program Files (x86)/GNU Arm Embedded Toolchain/arm-gnu-toolchain-14.2.rel1-mingw-w64-i686-arm-none-eabi" endif BINPFX = @$(GCCDIR)/bin/arm-none-eabi- @@ -251,7 +263,10 @@ LD_SCRIPT = $(GCCDIR)/share/gcc-arm-none-eabi/samples/ldscripts/mem.ld ### Build rules -.PHONY: clean +.PHONY: clean version + +version: + $(CC) --version clean: @echo CLEAN @@ -289,6 +304,6 @@ source file (empty.c) to an empty binary file (empty.bin). Next, I will select a micro-controller from the STM32 family and generate a binary file that it can execute. -
© 2020-2024 Renaud Fivet +
© 2020-2025 Renaud Fivet diff --git a/docs/12_bootstrap.html b/docs/12_bootstrap.html index dd0b556..c110648 100644 --- a/docs/12_bootstrap.html +++ b/docs/12_bootstrap.html @@ -84,7 +84,7 @@ LD_SCRIPT = $(GCCDIR)/share/gcc-arm-none-eabi/samples/ldscripts/nokeep.ld
 $ make empty.elf
 empty.elf
-D:\Program Files (x86)\GNU Arm Embedded Toolchain\arm-gnu-toolchain-13.3.rel1-mi
+D:\Program Files (x86)\GNU Arm Embedded Toolchain\arm-gnu-toolchain-14.2.rel1-mi
 ngw-w64-i686-arm-none-eabi\bin\arm-none-eabi-ld.exe: warning: cannot find entry 
 symbol Reset_Handler; defaulting to 00000000
 rm empty.o
@@ -175,7 +175,7 @@ LD_SCRIPT = f030f4.ld
 At boot time, the Arm core fetches the initial address of the stack pointer
 and the address where to start execution from the first two entries of its
 interrupt routine table. I have to modify boot.c to initialize such a
-table in accord with the symbols defined in the link script.
+table in accordance with the symbols defined in the link script.
 
 
 /* Memory locations defined by linker script */
@@ -262,9 +262,9 @@ indented.
 ### Build environment selection
 
 ifeq (linux, $(findstring linux, $(MAKE_HOST)))
- GCCDIR = $(HOME)/Packages/arm-gnu-toolchain-13.3.rel1-x86_64-arm-none-eabi
+ GCCDIR = $(HOME)/Packages/arm-gnu-toolchain-14.2.rel1-x86_64-arm-none-eabi
 else
- GCCDIR = "D:/Program Files (x86)/GNU Arm Embedded Toolchain/arm-gnu-toolchain-13.3.rel1-mingw-w64-i686-arm-none-eabi"
+ GCCDIR = "D:/Program Files (x86)/GNU Arm Embedded Toolchain/arm-gnu-toolchain-14.2.rel1-mingw-w64-i686-arm-none-eabi"
 endif
 
 BINPFX  = @$(GCCDIR)/bin/arm-none-eabi-
@@ -280,7 +280,10 @@ LD_SCRIPT = f030f4.ld
 
 ### Build rules
 
-.PHONY: clean
+.PHONY: clean version
+
+version:
+    $(CC) --version
 
 clean:
     @echo CLEAN
@@ -302,6 +305,6 @@ clean:
 
 
-
© 2020-2024 Renaud Fivet +
© 2020-2025 Renaud Fivet diff --git a/docs/13_flash.html b/docs/13_flash.html index 0809bd1..e9602ea 100644 --- a/docs/13_flash.html +++ b/docs/13_flash.html @@ -83,7 +83,7 @@ First I activate the connection in the programmer.
Then program and verify the bootstrap code. Either binary, Intel hex or -Motorola S rec format are supported. Our Makefile as rules for binary +Motorola S rec format are supported. Our Makefile has rules for binary and Intel hex, objcopy also support Motorola S record as an output format. Last build produced boot.hex. @@ -158,6 +158,6 @@ application. Next, I will provide feedback of execution directly through the board. -
© 2020-2024 Renaud Fivet +
© 2020-2025 Renaud Fivet diff --git a/docs/18_3stages.html b/docs/18_3stages.html index 0f01239..9022191 100644 --- a/docs/18_3stages.html +++ b/docs/18_3stages.html @@ -170,9 +170,9 @@ their SRCS line is uncommented. ### Build environment selection ifeq (linux, $(findstring linux, $(MAKE_HOST))) - GCCDIR = $(HOME)/Packages/arm-gnu-toolchain-13.3.rel1-x86_64-arm-none-eabi + GCCDIR = $(HOME)/Packages/arm-gnu-toolchain-14.2.rel1-x86_64-arm-none-eabi else - GCCDIR = "D:/Program Files (x86)/GNU Arm Embedded Toolchain/arm-gnu-toolchain-13.3.rel1-mingw-w64-i686-arm-none-eabi" + GCCDIR = "D:/Program Files (x86)/GNU Arm Embedded Toolchain/arm-gnu-toolchain-14.2.rel1-mingw-w64-i686-arm-none-eabi" endif BINPFX = @$(GCCDIR)/bin/arm-none-eabi- @@ -260,6 +260,6 @@ This step was mainly to achieve a better structure for future evolution. Next, I will make the code available in a public git repository. -
© 2020-2024 Renaud Fivet +
© 2020-2025 Renaud Fivet diff --git a/docs/23_hello.html b/docs/23_hello.html index f1e895f..b516ffe 100644 --- a/docs/23_hello.html +++ b/docs/23_hello.html @@ -111,7 +111,7 @@ To build I update the software composition in Makefile by adding a new
SRCS = startup.c usart1tx.c hello.c
Calling make, I can see that there is now some variable in BSS section -of the RAM. It is lastchar local to kputc(). Because +of the RAM. It is lastc local to kputc(). Because of word alignment BSS occupies 4 bytes.
@@ -155,6 +155,6 @@ support for other stdio functions when needed.
 Next, I will switch to an open source  tool
 for flashing over serial connection that works on both Windows and Linux.
 
-    
© 2020-2024 Renaud Fivet +
© 2020-2025 Renaud Fivet diff --git a/docs/25_prototype.html b/docs/25_prototype.html index 9eb2e82..e0f5dc3 100644 --- a/docs/25_prototype.html +++ b/docs/25_prototype.html @@ -98,15 +98,15 @@ Unfortunately, when I try to build an executable, the link phase fails.
 $ make
 f030f4.elf
-D:\Program Files (x86)\GNU Arm Embedded Toolchain\arm-gnu-toolchain-13.3.rel1-mi
+D:\Program Files (x86)\GNU Arm Embedded Toolchain\arm-gnu-toolchain-14.2.rel1-mi
 ngw-w64-i686-arm-none-eabi\bin\arm-none-eabi-ld.exe: uptime.1.o: in function `kp
 utu':
-D:\Projects\stm32bringup\docs/uptime.1.c:13:(.text+0x6): undefined reference to 
+D:\home\Projects\stm32bringup/uptime.1.c:13:(.text+0x6): undefined reference to 
 `__aeabi_uidivmod'
-D:\Program Files (x86)\GNU Arm Embedded Toolchain\arm-gnu-toolchain-13.3.rel1-mi
-ngw-w64-i686-arm-none-eabi\bin\arm-none-eabi-ld.exe: D:\Projects\stm32bringup\do
-cs/uptime.1.c:14:(.text+0x14): undefined reference to `__aeabi_uidiv'
-make: *** [Makefile:45: f030f4.elf] Error 1
+D:\Program Files (x86)\GNU Arm Embedded Toolchain\arm-gnu-toolchain-14.2.rel1-mi
+ngw-w64-i686-arm-none-eabi\bin\arm-none-eabi-ld.exe: D:\home\Projects\stm32bring
+up/uptime.1.c:14:(.text+0x14): undefined reference to `__aeabi_uidiv'
+make: *** [Makefile:49: f030f4.elf] Error 1
 
The compiler has generated code that references two functions @@ -123,12 +123,12 @@ no integer division support. So integer division needs to be implemented by code as it is not supported by hardware. I need to pass the linker a reference to GNU Arm Embedded Toolchain -library for Cortex-M0. The library file is libggc.a, the option -l and +library for Cortex-M0. The library file is libgcc.a, the option -l and -L of the linker tell what the library name is (-lgcc => libgcc.a) and where to look for it.
-LIBDIR  = $(GCCDIR)/lib/gcc/arm-none-eabi/13.3.1/thumb/v6-m/nofp
+LIBDIR  = $(GCCDIR)/lib/gcc/arm-none-eabi/14.2.1/thumb/v6-m/nofp
 LIB_PATHS = -L$(LIBDIR)
 LIBS = -lgcc
 
@@ -158,16 +158,16 @@ symbols (__aeabi_uidiv and __aeabi_idiv0).
 
 Archive member included to satisfy reference by file (symbol)
 
-D:/Program Files (x86)/GNU Arm Embedded Toolchain/arm-gnu-toolchain-13.3.rel1-mi
-ngw-w64-i686-arm-none-eabi/lib/gcc/arm-none-eabi/13.3.1/thumb/v6-m/nofp\libgcc.a
+D:/Program Files (x86)/GNU Arm Embedded Toolchain/arm-gnu-toolchain-14.2.rel1-mi
+ngw-w64-i686-arm-none-eabi/lib/gcc/arm-none-eabi/14.2.1/thumb/v6-m/nofp\libgcc.a
 (_udivsi3.o)
                               uptime.1.o (__aeabi_uidiv)
-D:/Program Files (x86)/GNU Arm Embedded Toolchain/arm-gnu-toolchain-13.3.rel1-mi
-ngw-w64-i686-arm-none-eabi/lib/gcc/arm-none-eabi/13.3.1/thumb/v6-m/nofp\libgcc.a
+D:/Program Files (x86)/GNU Arm Embedded Toolchain/arm-gnu-toolchain-14.2.rel1-mi
+ngw-w64-i686-arm-none-eabi/lib/gcc/arm-none-eabi/14.2.1/thumb/v6-m/nofp\libgcc.a
 (_dvmd_tls.o)
                               D:/Program Files (x86)/GNU Arm Embedded Toolchain/
-arm-gnu-toolchain-13.3.rel1-mingw-w64-i686-arm-none-eabi/lib/gcc/arm-none-eabi/1
-3.3.1/thumb/v6-m/nofp\libgcc.a(_udivsi3.o) (__aeabi_idiv0)
+arm-gnu-toolchain-14.2.rel1-mingw-w64-i686-arm-none-eabi/lib/gcc/arm-none-eabi/1
+4.2.1/thumb/v6-m/nofp\libgcc.a(_udivsi3.o) (__aeabi_idiv0)
 

Testing

@@ -205,12 +205,13 @@ the gcc library.
  • LIBS = -lstm32 -The ar command distributed by the GNU Arm embedded toolchain is -the same GNU ar as the Linux or Cygwin and MSYS2 distributions on -Windows. So I use my native environment implementation for convenience. -This is true for the utility commands (ar, objcopy, -objdump and size) but not for gcc and -ld. +The ar command distributed by the GNU Arm embedded toolchain is +the same GNU ar as found in the Linux distributions or Cygwin and +MSYS2 distributions on Windows. So I use my native environment implementation +for convenience. +This is true for the utility commands (ar, objcopy, +objdump and size) but not for gcc and +ld.

    Checkpoint

    @@ -225,6 +226,6 @@ I can use ar to extract locally those modules from the library. Next, I will write uptime with a better structure. -
    © 2020-2024 Renaud Fivet +
    © 2020-2025 Renaud Fivet diff --git a/docs/26_uptime.html b/docs/26_uptime.html index b6c8202..8ee60b6 100644 --- a/docs/26_uptime.html +++ b/docs/26_uptime.html @@ -241,12 +241,12 @@ Unfortunately, the build fails at the link phase.
     $ make
     f030f4.elf
    -D:\Program Files (x86)\GNU Arm Embedded Toolchain\arm-gnu-toolchain-13.3.rel1-mi
    +D:\Program Files (x86)\GNU Arm Embedded Toolchain\arm-gnu-toolchain-14.2.rel1-mi
     ngw-w64-i686-arm-none-eabi\bin\arm-none-eabi-ld.exe: uptime.o: in function `main
     ':
    -D:\Projects\stm32bringup\docs/uptime.c:41:(.text.startup+0xa4): 
    -undefined reference to `putchar'
    -make: *** [Makefile:49: f030f4.elf] Error 1
    +D:\home\Projects\stm32bringup/uptime.c:41:(.text.startup+0xa4): undefined refere
    +nce to `putchar'
    +make: *** [Makefile:53: f030f4.elf] Error 1
     
    The linker found a reference to putchar() at line 41 of @@ -284,7 +284,7 @@ The build now complete successfully. $ make f030f4.elf text data bss dec hex filename - 1797 0 12 1809 711 f030f4.elf + 1325 0 12 1337 539 f030f4.elf f030f4.hex f030f4.bin
  • @@ -297,14 +297,24 @@ code to handle switch() statement are now referenced.
     Archive member included to satisfy reference by file (symbol)
     
    -D:/Program Files (x86)/GNU Arm Embedded Toolchain/arm-gnu-toolchain-13.3.rel1-mingw-w64-i686-arm-none-eabi/lib/gcc/arm-none-eabi/13.3.1/thumb/v6-m/nofp\libgcc.a(_thumb1_case_sqi.o)
    +D:/Program Files (x86)/GNU Arm Embedded Toolchain/arm-gnu-toolchain-14.2.rel1-mi
    +ngw-w64-i686-arm-none-eabi/lib/gcc/arm-none-eabi/14.2.1/thumb/v6-m/nofp\libgcc.a
    +(_thumb1_case_sqi.o)
                                   printf.o (__gnu_thumb1_case_sqi)
    -D:/Program Files (x86)/GNU Arm Embedded Toolchain/arm-gnu-toolchain-13.3.rel1-mingw-w64-i686-arm-none-eabi/lib/gcc/arm-none-eabi/13.3.1/thumb/v6-m/nofp\libgcc.a(_udivsi3.o)
    +D:/Program Files (x86)/GNU Arm Embedded Toolchain/arm-gnu-toolchain-14.2.rel1-mi
    +ngw-w64-i686-arm-none-eabi/lib/gcc/arm-none-eabi/14.2.1/thumb/v6-m/nofp\libgcc.a
    +(_udivsi3.o)
                                   uptime.o (__aeabi_uidiv)
    -D:/Program Files (x86)/GNU Arm Embedded Toolchain/arm-gnu-toolchain-13.3.rel1-mingw-w64-i686-arm-none-eabi/lib/gcc/arm-none-eabi/13.3.1/thumb/v6-m/nofp\libgcc.a(_divsi3.o)
    +D:/Program Files (x86)/GNU Arm Embedded Toolchain/arm-gnu-toolchain-14.2.rel1-mi
    +ngw-w64-i686-arm-none-eabi/lib/gcc/arm-none-eabi/14.2.1/thumb/v6-m/nofp\libgcc.a
    +(_divsi3.o)
                                   uptime.o (__aeabi_idiv)
    -D:/Program Files (x86)/GNU Arm Embedded Toolchain/arm-gnu-toolchain-13.3.rel1-mingw-w64-i686-arm-none-eabi/lib/gcc/arm-none-eabi/13.3.1/thumb/v6-m/nofp\libgcc.a(_dvmd_tls.o)
    -                              D:/Program Files (x86)/GNU Arm Embedded Toolchain/arm-gnu-toolchain-13.3.rel1-mingw-w64-i686-arm-none-eabi/lib/gcc/arm-none-eabi/13.3.1/thumb/v6-m/nofp\libgcc.a(_udivsi3.o) (__aeabi_idiv0)
    +D:/Program Files (x86)/GNU Arm Embedded Toolchain/arm-gnu-toolchain-14.2.rel1-mi
    +ngw-w64-i686-arm-none-eabi/lib/gcc/arm-none-eabi/14.2.1/thumb/v6-m/nofp\libgcc.a
    +(_dvmd_tls.o)
    +                              D:/Program Files (x86)/GNU Arm Embedded Toolchain/
    +arm-gnu-toolchain-14.2.rel1-mingw-w64-i686-arm-none-eabi/lib/gcc/arm-none-eabi/1
    +4.2.1/thumb/v6-m/nofp\libgcc.a(_udivsi3.o) (__aeabi_idiv0)
     

    Test

    @@ -326,14 +336,14 @@ make sure days and weeks values are correct. It’s also clear that the test coverage for the printf format interpreter is not sufficient as I have coded more than is necessary to implement uptime.

    -I didn’t expect gcc to optimize call to high level C functions, -replacing printf() by putchar(), thus forcing me to -write additional code. So far I am not concerned by execution speed, so this +I didn’t expect gcc to optimize calls to high level C functions, +replacing some printf() by putchar(), thus forcing me +to write additional code. So far I am not concerned by execution speed, so this type of optimization is a bit counter productive.

    Next, I will make sure that what belongs to the library category fits in an actual library file. -


    © 2020-2024 Renaud Fivet +
    © 2020-2025 Renaud Fivet diff --git a/docs/27_library.html b/docs/27_library.html index 338284e..ff68812 100644 --- a/docs/27_library.html +++ b/docs/27_library.html @@ -36,7 +36,7 @@ int puts( const char *s) {

    Updating Makefile

    I need to tell GNU make how to manage and use the library, which -means updating Makefile. +means updating Makefile with the following informations:

    What’s the name, the content and the rule to maintain the library: @@ -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 - 1797 0 12 1809 711 f030f4.elf + 1325 0 12 1337 539 f030f4.elf f030f4.hex f030f4.bin

    @@ -100,26 +100,22 @@ newly created library.
     Archive member included to satisfy reference by file (symbol)
     
    -.\libstm32.a(printf.o)        uptime.o (printf)
    -.\libstm32.a(putchar.o)       uptime.o (putchar)
    -D:/Program Files (x86)/GNU Arm Embedded Toolchain/arm-gnu-toolchain-13.3.rel1-mi
    -ngw-w64-i686-arm-none-eabi/lib/gcc/arm-none-eabi/13.3.1/thumb/v6-m/nofp\libgcc.a
    +libstm32.a(printf.o)          uptime.o (printf)
    +libstm32.a(putchar.o)         uptime.o (putchar)
    +D:/Program Files (x86)/GNU Arm Embedded Toolchain/arm-gnu-toolchain-14.2.rel1-mi
    +ngw-w64-i686-arm-none-eabi/lib/gcc/arm-none-eabi/14.2.1/thumb/v6-m/nofp\libgcc.a
     (_thumb1_case_sqi.o)
    -                              .\libstm32.a(printf.o) (__gnu_thumb1_case_sqi)
    -D:/Program Files (x86)/GNU Arm Embedded Toolchain/arm-gnu-toolchain-13.3.rel1-mi
    -ngw-w64-i686-arm-none-eabi/lib/gcc/arm-none-eabi/13.3.1/thumb/v6-m/nofp\libgcc.a
    +                              libstm32.a(printf.o) (__gnu_thumb1_case_sqi)
    +D:/Program Files (x86)/GNU Arm Embedded Toolchain/arm-gnu-toolchain-14.2.rel1-mi
    +ngw-w64-i686-arm-none-eabi/lib/gcc/arm-none-eabi/14.2.1/thumb/v6-m/nofp\libgcc.a
     (_udivsi3.o)
                                   uptime.o (__aeabi_uidiv)
    -D:/Program Files (x86)/GNU Arm Embedded Toolchain/arm-gnu-toolchain-13.3.rel1-mi
    -ngw-w64-i686-arm-none-eabi/lib/gcc/arm-none-eabi/13.3.1/thumb/v6-m/nofp\libgcc.a
    -(_divsi3.o)
    -                              uptime.o (__aeabi_idiv)
    -D:/Program Files (x86)/GNU Arm Embedded Toolchain/arm-gnu-toolchain-13.3.rel1-mi
    -ngw-w64-i686-arm-none-eabi/lib/gcc/arm-none-eabi/13.3.1/thumb/v6-m/nofp\libgcc.a
    +D:/Program Files (x86)/GNU Arm Embedded Toolchain/arm-gnu-toolchain-14.2.rel1-mi
    +ngw-w64-i686-arm-none-eabi/lib/gcc/arm-none-eabi/14.2.1/thumb/v6-m/nofp\libgcc.a
     (_dvmd_tls.o)
                                   D:/Program Files (x86)/GNU Arm Embedded Toolchain/
    -arm-gnu-toolchain-13.3.rel1-mingw-w64-i686-arm-none-eabi/lib/gcc/arm-none-eabi/1
    -3.3.1/thumb/v6-m/nofp\libgcc.a(_udivsi3.o) (__aeabi_idiv0)
    +arm-gnu-toolchain-14.2.rel1-mingw-w64-i686-arm-none-eabi/lib/gcc/arm-none-eabi/1
    +4.2.1/thumb/v6-m/nofp\libgcc.a(_udivsi3.o) (__aeabi_idiv0)
     

    Building hello

    @@ -147,7 +143,7 @@ Checking the map file produced in the link phase, I can see that only
     Archive member included to satisfy reference by file (symbol)
     
    -.\libstm32.a(puts.o)          hello.o (puts)
    +libstm32.a(puts.o)          hello.o (puts)
     

    Checkpoint

    @@ -159,6 +155,6 @@ implementation of the standard C library output functions is a simple step. Next, I will continue on the topic of asynchronous serial transmission and look into baud rate and clock configuration. -
    © 2020-2024 Renaud Fivet +
    © 2020-2025 Renaud Fivet diff --git a/docs/28_clocks.html b/docs/28_clocks.html index 1457919..c112bab 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 - 1901 0 12 1913 779 f030f4.elf + 1441 0 12 1453 5ad f030f4.elf f030f4.hex f030f4.bin
    @@ -328,6 +328,6 @@ me some flexibility and ease of setup. Next, I will implement interrupt driven transmission. -
    © 2020-2024 Renaud Fivet +
    © 2020-2025 Renaud Fivet diff --git a/docs/29_interrupt.html b/docs/29_interrupt.html index 8373339..67ad248 100644 --- a/docs/29_interrupt.html +++ b/docs/29_interrupt.html @@ -246,18 +246,18 @@ Build completes successfully $ make f030f4.elf from startup.txeie.o txeie.o uptime.o text data bss dec hex filename - 2097 0 20 2117 845 f030f4.elf + 1641 0 20 1661 67d f030f4.elf f030f4.hex f030f4.bin Checking the map and lst files I can verify that -
    © 2020-2024 Renaud Fivet +
    © 2020-2025 Renaud Fivet