FreeCalypso > hg > freecalypso-tools
annotate doc/Flash-boot-wa @ 465:003e48f8ebe1
rvinterf/etmsync/fsnew.c: cast 0 to (char *) for execl sentinel
I generally don't use NULL and use plain 0 instead, based on a "NULL
considered harmful" discussion on the classiccmp mailing list many aeons
ago (I couldn't find it, and I reason that it must have been 2005 or
earlier), but a recent complaint by a packager sent me searching, and I
found this:
https://ewontfix.com/11/
While I don't give a @#$% about "modern" systems and code-nazi tools,
I realized that passing a plain 0 as a pointer sentinel in execl is wrong
because it will break on systems where pointers are longer than the plain
int type. Again, I don't give a @#$% about the abomination of x86_64 and
the like, but if anyone ever manages to port my code to something like a
PDP-11 (16-bit int, 32-bit long and pointers), then passing a plain 0
as a function argument where a pointer is expected most definitely won't
work: if the most natural stack slot and SP alignment unit is 16 bits,
fitting an int, with longs and pointers taking up two such slots, then
the call stack will be totally wrong with a plain 0 passed for a pointer.
Casting the 0 to (char *) ought to be the most kosher solution for the
most retro systems possible.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 11 Feb 2019 00:00:19 +0000 |
parents | efb93f3e4ac7 |
children |
rev | line source |
---|---|
462
efb93f3e4ac7
doc/Flash-boot-wa: explanatory article added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 There is a tiny (120 bytes SREC file) program called flash-boot-wa that was |
efb93f3e4ac7
doc/Flash-boot-wa: explanatory article added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 written in the spring of 2017 for the purpose of working around a problem that |
efb93f3e4ac7
doc/Flash-boot-wa: explanatory article added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 happened on only one first-batch FCDEV3B board and never happened on any other |
efb93f3e4ac7
doc/Flash-boot-wa: explanatory article added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 board - but Murphy's law had it that this one troubled board just had to be the |
efb93f3e4ac7
doc/Flash-boot-wa: explanatory article added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 one on which my (Mother Mychaela's) very initial development and bring-up work |
efb93f3e4ac7
doc/Flash-boot-wa: explanatory article added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 was done. |
efb93f3e4ac7
doc/Flash-boot-wa: explanatory article added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 |
efb93f3e4ac7
doc/Flash-boot-wa: explanatory article added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 The defect exhibited on that one board was as follows: it had no problem booting |
efb93f3e4ac7
doc/Flash-boot-wa: explanatory article added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 serially (fc-iram, fc-loadtool, fc-xram) and it had no problem booting from |
efb93f3e4ac7
doc/Flash-boot-wa: explanatory article added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 flash in mode 0 (see the Flash-boot-modes article in the freecalypso-docs |
efb93f3e4ac7
doc/Flash-boot-wa: explanatory article added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 repository), but booting from flash in mode 1 (the flash boot mode used by |
efb93f3e4ac7
doc/Flash-boot-wa: explanatory article added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 FC Magnetite, which is our primary firmware) was troubled. The exact failure |
efb93f3e4ac7
doc/Flash-boot-wa: explanatory article added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 mode and the root cause were never solved, but the issue most likely involved |
efb93f3e4ac7
doc/Flash-boot-wa: explanatory article added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 the watchdog reset in some way (it occurs as part of flash boot mode 1 but not |
efb93f3e4ac7
doc/Flash-boot-wa: explanatory article added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 in mode 0 and not in serial downloading), and because Calypso's FDP output goes |
efb93f3e4ac7
doc/Flash-boot-wa: explanatory article added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 low during watchdog reset (or at least TI's CAL000 document says so), it is |
efb93f3e4ac7
doc/Flash-boot-wa: explanatory article added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 plausible that the root cause involved the Spansion flash chip getting unhappy |
efb93f3e4ac7
doc/Flash-boot-wa: explanatory article added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 as a result of being jerked with extra resets which don't meet its reset timing |
efb93f3e4ac7
doc/Flash-boot-wa: explanatory article added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 requirements. |
efb93f3e4ac7
doc/Flash-boot-wa: explanatory article added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 |
efb93f3e4ac7
doc/Flash-boot-wa: explanatory article added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 Our new FCDEV3B V2 boards no longer use Calypso's FDP output (it is left |
efb93f3e4ac7
doc/Flash-boot-wa: explanatory article added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 unconnected) and feature a new flash reset circuit of our own design that meets |
efb93f3e4ac7
doc/Flash-boot-wa: explanatory article added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 the reset timing requirements of our Spansion flash chip, hence the flash boot |
efb93f3e4ac7
doc/Flash-boot-wa: explanatory article added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 problem seen on that one FCDEV3B S/N 001 board is not expected to recur on any |
efb93f3e4ac7
doc/Flash-boot-wa: explanatory article added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 of our current or future boards. However, our little flash-boot-wa program is |
efb93f3e4ac7
doc/Flash-boot-wa: explanatory article added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 kept around: removing a previously-released 120-byte program for no good reason |
efb93f3e4ac7
doc/Flash-boot-wa: explanatory article added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 is not the way of FOSS. |
efb93f3e4ac7
doc/Flash-boot-wa: explanatory article added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 |
efb93f3e4ac7
doc/Flash-boot-wa: explanatory article added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 This flash-boot-wa program is loaded serially via fc-iram; it disables the boot |
efb93f3e4ac7
doc/Flash-boot-wa: explanatory article added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 ROM and jumps to address 0 (the opposite of what we do in compalstage for Mot |
efb93f3e4ac7
doc/Flash-boot-wa: explanatory article added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 C1xx phones), thereby indirectly booting the made-for-boot-mode-1 firmware image |
efb93f3e4ac7
doc/Flash-boot-wa: explanatory article added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 in the flash. The intended usage was as follows: |
efb93f3e4ac7
doc/Flash-boot-wa: explanatory article added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 |
efb93f3e4ac7
doc/Flash-boot-wa: explanatory article added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 fc-iram -h fcfam /dev/ttyXXX /opt/freecalypso/target-bin/flash-boot-wa.srec rvinterf |
efb93f3e4ac7
doc/Flash-boot-wa: explanatory article added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 |
efb93f3e4ac7
doc/Flash-boot-wa: explanatory article added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 It is also worth noting that fc-iram has been extended to support second program |
efb93f3e4ac7
doc/Flash-boot-wa: explanatory article added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 invokation just like fc-xram (used in the invokation line above) just for this |
efb93f3e4ac7
doc/Flash-boot-wa: explanatory article added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 peculiar use case. The flash-boot-wa.srec helper can also be booted via |
efb93f3e4ac7
doc/Flash-boot-wa: explanatory article added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 fc-xram. |