Skip to content

Commit 5b5a13f

Browse files
committed
Insure consistency between code and documentation.
1 parent 2ee50ea commit 5b5a13f

13 files changed

+46
-34
lines changed

crc32/Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# Makefile -- sign32
2-
# Copyright (c) 2021 Renaud Fivet
2+
# Copyright (c) 2021-2025 Renaud Fivet
33

44
# silence unused parameter warning
55
WARNINGS=-pedantic -Wall -Wextra -Wstrict-prototypes -Wno-unused-parameter
66
CFLAGS = $(WARNINGS) -O2
7+
LDFLAGS = -s
78

89
all: sign32

dht11main.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/* dht11main.c -- sample DHT11 sensor */
2-
/* Copyright (c) 2020-2021 Renaud Fivet */
2+
/* Copyright (c) 2020-2023 Renaud Fivet */
33
#include <stdio.h>
44

55
#include "system.h"
66
#include "dht11.h"
77

88
int main( void) {
9-
static unsigned last ;
9+
unsigned last = 0 ;
1010

1111
dht11_init() ;
1212
for( ;;)
@@ -17,7 +17,8 @@ int main( void) {
1717
if( 2 == (last % 5)) /* every 5 seconds starting 2s after boot */
1818
switch( dht11_read()) {
1919
case DHT11_SUCCESS:
20-
printf( "%u%%RH, %d.%uC\n", dht11_humid, dht11_tempc, dht11_tempf) ;
20+
printf( "%u%%RH, %d.%uC\n", dht11_humid, dht11_tempc,
21+
dht11_tempf) ;
2122
break ;
2223
case DHT11_FAIL_TOUT:
2324
puts( "Timeout") ;

docs/25_prototype.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ <h2>Implementation</h2>
7171
}
7272

7373
int main( void) {
74-
static unsigned last ;
74+
unsigned last = 0 ;
7575

7676
for( ;;)
7777
if( last != uptime) {

docs/26_uptime.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ <h2>Application</h2>
195195
}
196196

197197
int main( void) {
198-
static unsigned last ;
198+
unsigned last = 0 ;
199199

200200
for( ;;)
201201
if( last != uptime) {
@@ -284,7 +284,7 @@ <h2>Build</h2>
284284
$ make
285285
f030f4.elf
286286
text data bss dec hex filename
287-
1325 0 12 1337 539 f030f4.elf
287+
1317 0 8 1325 52d f030f4.elf
288288
f030f4.hex
289289
f030f4.bin
290290
</pre>

docs/27_library.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ <h2>Building uptime</h2>
8888
$ make
8989
f030f4.elf from startup.o uplow.2.o uptime.o
9090
text data bss dec hex filename
91-
1325 0 12 1337 539 f030f4.elf
91+
1317 0 8 1325 52d f030f4.elf
9292
f030f4.hex
9393
f030f4.bin
9494
</pre>

docs/28_clocks.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ <h2>Build and test</h2>
310310
$ make
311311
f030f4.elf from startup.o clocks.o uptime.o
312312
text data bss dec hex filename
313-
1441 0 12 1453 5ad f030f4.elf
313+
1433 0 8 1441 5a1 f030f4.elf
314314
f030f4.hex
315315
f030f4.bin
316316
</pre>

docs/29_interrupt.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ <h2>Build and test</h2>
246246
$ make
247247
f030f4.elf from startup.txeie.o txeie.o uptime.o
248248
text data bss dec hex filename
249-
1641 0 20 1661 67d f030f4.elf
249+
1633 0 16 1649 671 f030f4.elf
250250
f030f4.hex
251251
f030f4.bin
252252
</pre>

docs/31_dht11.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ <h2>DHT11 API</h2>
220220
#include "dht11.h"
221221

222222
int main() {
223-
static unsigned last ;
223+
unsigned last = 0 ;
224224

225225
dht11_init() ;
226226
for( ;;)
@@ -408,7 +408,7 @@ <h2>Build and basic test</h2>
408408
$ make
409409
f030f4.elf from startup.txeie.o gpioa.o dht11main.o dht11.o
410410
text data bss dec hex filename
411-
1877 0 24 1901 76d f030f4.elf
411+
1861 0 20 1881 759 f030f4.elf
412412
f030f4.hex
413413
f030f4.bin
414414
</pre>
@@ -429,6 +429,6 @@ <h2>Checkpoint</h2>
429429
<a href="32_errata.html">Next</a>, I will investigate if the values read are
430430
correct.
431431

432-
<hr>© 2020-2024 Renaud Fivet
432+
<hr>© 2020-2025 Renaud Fivet
433433
</body>
434434
</html>

docs/34_adcvnt.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ <h2>Build and test</h2>
340340
| ^~~~~~~
341341
f030f4.elf from startup.txeie.o adc.o adcmain.o
342342
text data bss dec hex filename
343-
2464 0 16 2480 9b0 f030f4.elf
343+
2408 0 16 2424 978 f030f4.elf
344344
f030f4.hex
345345
f030f4.bin
346346
</pre>
@@ -366,6 +366,6 @@ <h2>Checkpoint</h2>
366366
means taking two measurements as far apart as possible in the working range I
367367
want to use.
368368

369-
<hr>© 2020-2024 Renaud Fivet
369+
<hr>© 2020-2025 Renaud Fivet
370370
</body>
371371
</html>

docs/36_update.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ <h2>PATH based command selection</h2>
130130
ifeq (linux, $(findstring linux, $(MAKE_HOST)))
131131
INSTALLDIR = $(HOME)/Packages
132132
#REVDIR = gcc-arm-none-eabi-10-2020-q4-major
133-
REVDIR = arm-gnu-toolchain-13.3.rel1-x86_64-arm-none-eabi
133+
REVDIR = arm-gnu-toolchain-14.2.rel1-x86_64-arm-none-eabi
134134
else
135135
DRIVE = d
136136
ifeq (cygwin, $(findstring cygwin, $(MAKE_HOST)))
@@ -142,7 +142,7 @@ <h2>PATH based command selection</h2>
142142
endif
143143
INSTALLDIR = $(OSDRIVE)/Program Files (x86)
144144
#REVDIR = GNU Arm Embedded Toolchain/10 2020-q4-major
145-
REVDIR = GNU Arm Embedded Toolchain/arm-gnu-toolchain-13.3.rel1-mingw-w64-i686-arm-none-eabi
145+
REVDIR = GNU Arm Embedded Toolchain/arm-gnu-toolchain-14.2.rel1-mingw-w64-i686-arm-none-eabi
146146
endif
147147

148148
GCCDIR = $(INSTALLDIR)/$(REVDIR)
@@ -174,6 +174,6 @@ <h2>Checkpoint</h2>
174174
<a href="37_inram.html">Next</a>, I will (re)build to execute code in RAM
175175
instead of FLASH.
176176

177-
<hr>© 2020-2024 Renaud Fivet
177+
<hr>© 2020-2025 Renaud Fivet
178178
</body>
179179
</html>

docs/37_inram.html

+23-13
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ <h3> 3. Makefile</h3>
384384
cstartup.elf: cstartup.o
385385

386386
%.elf:
387-
@echo $@
387+
@echo $@ from $+
388388
$(CC) $(CPU) -T$(LD_SCRIPT) $(LDFLAGS) -nostartfiles -o $@ $+
389389
$(SIZE) $@
390390
$(OBJDUMP) -hS $@ > $(subst .elf,.lst,$@)
@@ -397,15 +397,26 @@ <h3> 3. Makefile</h3>
397397
Finally, to keep track of the memory model and the load location, I put
398398
the load address in the name of the binary file generated.
399399

400-
<pre>all: $(PROJECT).$(BINLOC).bin $(PROJECT).hex</pre>
400+
<pre>all: $(PROJECT).hex $(PROJECT).$(BINLOC).bin</pre>
401+
402+
With the corresponding rule
403+
404+
<pre>
405+
%.$(BINLOC).bin: %.elf
406+
@echo $@
407+
$(OBJCOPY) -O binary $< $@
408+
</pre>
401409

402410
This way if I build uptime prototype in GORAM memory model
403411

404412
<pre>
405413
$ make
406-
f030f4.elf
414+
f030f4.elf from startup.ram.o txeie.o uptime.1.o libstm32.a
415+
Memory region Used Size Region Size %age Used
416+
FLASH: 1163 B 2 KB 56.79%
417+
RAM: 208 B 2 KB 10.16%
407418
text data bss dec hex filename
408-
1164 0 20 1184 4a0 f030f4.elf
419+
1163 0 208 1371 55b f030f4.elf
409420
f030f4.hex
410421
f030f4.0x20000800.bin
411422
</pre>
@@ -419,19 +430,18 @@ <h3> 3. Makefile</h3>
419430

420431
<h2>Caveat: stm32flash v0.6 intel hex bug</h2>
421432

422-
At the time of writing, <b>stm32flash</b> v0.6 has a bug that prevents
423-
writing intel hex files correctly at address other than the origin of
424-
the Flash. A bug fix and the possibility to directly read the base
425-
address from the intel hex file are planned to be included in v0.7.
433+
<b>stm32flash</b> v0.6 had a bug that prevents writing intel hex files
434+
correctly at address other than the origin of the Flash. A bug fix and the
435+
possibility to directly read the base address from the intel hex file was
436+
merged in v0.7.
426437
<p>
427-
Until v0.7 is out, I am using my own patched version of stm32flash or
428-
the binary files when I need to test GOFLASH and GORAM memory models.
429-
<p>
430-
As I branched off my own patched version of <b>stm32flash</b>, I added a
438+
I have branched off my own patched version of <b>stm32flash</b>, I added a
431439
<code>-x</code> option to write and execute an intel hex file:
432440

433441
<pre>stm32flash -x file.hex COM#</pre>
434442

443+
This patch is scheduled to be merged in v0.8.
444+
435445
<h2>Testing</h2>
436446

437447
I build all four memory models and check that they can be loaded and
@@ -448,6 +458,6 @@ <h2>Checkpoint</h2>
448458
<a href="38_crc32.html">Next</a>, I will add integrity check at startup by
449459
doing CRC32 validation of the code.
450460

451-
<hr>© 2020-2024 Renaud Fivet
461+
<hr>© 2020-2025 Renaud Fivet
452462
</body>
453463
</html>

uptime.1.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* uptime.1.c -- tells how long the system has been running
2-
** Copyright (c) 2020 Renaud Fivet
2+
** Copyright (c) 2020-2023 Renaud Fivet
33
**
44
** v1 displays the number of seconds elapsed since boot
55
*/
@@ -19,7 +19,7 @@ void kputu( unsigned u) {
1919
}
2020

2121
int main( void) {
22-
static unsigned last ;
22+
unsigned last = 0 ;
2323

2424
for( ;;)
2525
if( last != uptime) {

uptime.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* uptime.c -- tells how long the system has been running */
2-
/* Copyright (c) 2020 Renaud Fivet */
2+
/* Copyright (c) 2020-2023 Renaud Fivet */
33

44
#include <stdio.h>
55
#include "system.h" /* uptime, yield() */

0 commit comments

Comments
 (0)