Files
tamagotchi-paradise-ko/flash
syskiller 2d48091205 줄바꿈을 LF로 통일
서버에서 바로 빌드하고 고칠 수 있게 저장소 줄바꿈을 LF로 맞췄습니다.
CRLF로 들어가 있던 sh 빌드 스크립트도 이제 리눅스에서 그대로 돌아갑니다.
내용은 바뀌지 않았습니다.
2026-11-24 07:13:54 +09:00
..
2026-11-24 07:13:54 +09:00
2026-11-24 07:13:54 +09:00

Flash app

Our own program for reading and writing the Paradise flash over UART. The Studio loads it into the device's RAM from the download screen (the device's own app loading, no P-COM, nothing is written to flash for this). Switching the device off and on returns to the normal firmware.

  • flashapp.bin: the program (runs from PRAM 0, 64 KB window).
  • src/fw.c: source. Talks the PAU1 protocol on UART1 at 460800 baud and shows its own screen with a progress bar.

PAU1

Frames are COBS encoded and end with a zero byte. Inside: "PAU1", version, flags, type, session, sequence, offset, payload length, status, payload, CRC-32.

Type Command Payload
1 HELLO answer: 44 bytes (edition, block size, JEDEC ID, capacity, flash error)
5 READ length; answer: data
6 CRC length; answer: CRC-32 of the range
8 WRITE_TEST self test
9 WRITE_BEGIN SHA-256 and CRC-32 of the image; answer: start sector
10 WRITE_DATA data for the sector buffer
11 WRITE_COMMIT CRC-32 of the sector; erases, programs, compares; answer: CRC and error flag (FW_PRECHECK: the buffer is checked against the CRC first, error 2 = nothing written, send again)
12 WRITE_FINISH end
13 WRITE_STATE writer state

The host side is src/flash.js in the Studio.

Build

sh src/build.sh     # clang, ld.lld, llvm-objcopy -> flashapp.bin (byte-identical)

License: GNU GPL version 3 or later.