From 5d88163b891a08ed933e6d6a2cc7341303e987ea Mon Sep 17 00:00:00 2001 From: Manfred Steiner Date: Thu, 5 Sep 2024 11:10:12 +0200 Subject: [PATCH] software/nano-1284/bootloader-arduino (2024-09-05_070344) --- .../bootloader-arduino/.gdb_history | 0 .../bootloader-arduino/.gdbinit | 0 .../bootloader-arduino/.gitignore | 0 .../.vscode/c_cpp_properties.json | 0 .../bootloader-arduino/.vscode/launch.json | 0 .../bootloader-arduino/.vscode/settings.json | 7 +-- .../bootloader-arduino/.vscode/tasks.json | 0 .../bootloader-arduino/Makefile | 5 +- .../bootloader-arduino/README.md | 0 .../bootloader-arduino/protocol | 0 .../bootloader-arduino_nano-1284.elf | Bin 9972 -> 9972 bytes .../bootloader-arduino_nano-1284.hex | 4 +- .../bootloader-arduino/src/main.c | 55 +++++++++--------- 13 files changed, 34 insertions(+), 37 deletions(-) rename software/{ => nano-1284}/bootloader-arduino/.gdb_history (100%) rename software/{ => nano-1284}/bootloader-arduino/.gdbinit (100%) rename software/{ => nano-1284}/bootloader-arduino/.gitignore (100%) rename software/{ => nano-1284}/bootloader-arduino/.vscode/c_cpp_properties.json (100%) rename software/{ => nano-1284}/bootloader-arduino/.vscode/launch.json (100%) rename software/{ => nano-1284}/bootloader-arduino/.vscode/settings.json (76%) rename software/{ => nano-1284}/bootloader-arduino/.vscode/tasks.json (100%) rename software/{ => nano-1284}/bootloader-arduino/Makefile (96%) rename software/{ => nano-1284}/bootloader-arduino/README.md (100%) rename software/{ => nano-1284}/bootloader-arduino/protocol (100%) rename software/{bootloader-arduino/release/2024-09-05_070344 => nano-1284/bootloader-arduino/release/2024-09-05_110459}/bootloader-arduino_nano-1284.elf (99%) rename software/{bootloader-arduino/release/2024-09-05_070344 => nano-1284/bootloader-arduino/release/2024-09-05_110459}/bootloader-arduino_nano-1284.hex (95%) rename software/{ => nano-1284}/bootloader-arduino/src/main.c (92%) diff --git a/software/bootloader-arduino/.gdb_history b/software/nano-1284/bootloader-arduino/.gdb_history similarity index 100% rename from software/bootloader-arduino/.gdb_history rename to software/nano-1284/bootloader-arduino/.gdb_history diff --git a/software/bootloader-arduino/.gdbinit b/software/nano-1284/bootloader-arduino/.gdbinit similarity index 100% rename from software/bootloader-arduino/.gdbinit rename to software/nano-1284/bootloader-arduino/.gdbinit diff --git a/software/bootloader-arduino/.gitignore b/software/nano-1284/bootloader-arduino/.gitignore similarity index 100% rename from software/bootloader-arduino/.gitignore rename to software/nano-1284/bootloader-arduino/.gitignore diff --git a/software/bootloader-arduino/.vscode/c_cpp_properties.json b/software/nano-1284/bootloader-arduino/.vscode/c_cpp_properties.json similarity index 100% rename from software/bootloader-arduino/.vscode/c_cpp_properties.json rename to software/nano-1284/bootloader-arduino/.vscode/c_cpp_properties.json diff --git a/software/bootloader-arduino/.vscode/launch.json b/software/nano-1284/bootloader-arduino/.vscode/launch.json similarity index 100% rename from software/bootloader-arduino/.vscode/launch.json rename to software/nano-1284/bootloader-arduino/.vscode/launch.json diff --git a/software/bootloader-arduino/.vscode/settings.json b/software/nano-1284/bootloader-arduino/.vscode/settings.json similarity index 76% rename from software/bootloader-arduino/.vscode/settings.json rename to software/nano-1284/bootloader-arduino/.vscode/settings.json index 114a717..1d7e197 100644 --- a/software/bootloader-arduino/.vscode/settings.json +++ b/software/nano-1284/bootloader-arduino/.vscode/settings.json @@ -12,10 +12,5 @@ "cSpell.words": [], "cSpell.ignorePaths": [ "**/*.json", "**/*.c", "**/*.h", "**/Makefile" - ], - "files.associations": { - "delay.h": "c", - "boot.h": "c", - "stdio.h": "c" - } + ] } diff --git a/software/bootloader-arduino/.vscode/tasks.json b/software/nano-1284/bootloader-arduino/.vscode/tasks.json similarity index 100% rename from software/bootloader-arduino/.vscode/tasks.json rename to software/nano-1284/bootloader-arduino/.vscode/tasks.json diff --git a/software/bootloader-arduino/Makefile b/software/nano-1284/bootloader-arduino/Makefile similarity index 96% rename from software/bootloader-arduino/Makefile rename to software/nano-1284/bootloader-arduino/Makefile index 665918a..7580934 100644 --- a/software/bootloader-arduino/Makefile +++ b/software/nano-1284/bootloader-arduino/Makefile @@ -95,6 +95,9 @@ isp-1284p: isp-flash-1284p: dist/$(NAME).elf all avrdude -c usbasp -p m1284p -e -U flash:w:$< +isp-read-flash-1284p: + avrdude -c usbasp -p m1284p -U flash:r:/tmp/flash-nano-1284__$(shell date +"%Y-%m-%d_%H%M%S") + flash-1284p: dist/$(NAME).elf all avrdude -c arduino -p m1284p -P /dev/ttyUSB0 -b 115200 -e -U flash:w:$< @@ -105,7 +108,7 @@ picocom: isp-erase-1284p: avrdude -c usbasp -p m1284p -e - + isp-fuse-1284p: # LFUSE=0xE7 -> startuptime 16K CLOCKS + 4.1ms -> 5.4ms avrdude -c usbasp -p m1284p -U lfuse:w:0xEF:m -U hfuse:w:0xD8:m -U efuse:w:0xFE:m -U lock:w:0xEF:m diff --git a/software/bootloader-arduino/README.md b/software/nano-1284/bootloader-arduino/README.md similarity index 100% rename from software/bootloader-arduino/README.md rename to software/nano-1284/bootloader-arduino/README.md diff --git a/software/bootloader-arduino/protocol b/software/nano-1284/bootloader-arduino/protocol similarity index 100% rename from software/bootloader-arduino/protocol rename to software/nano-1284/bootloader-arduino/protocol diff --git a/software/bootloader-arduino/release/2024-09-05_070344/bootloader-arduino_nano-1284.elf b/software/nano-1284/bootloader-arduino/release/2024-09-05_110459/bootloader-arduino_nano-1284.elf similarity index 99% rename from software/bootloader-arduino/release/2024-09-05_070344/bootloader-arduino_nano-1284.elf rename to software/nano-1284/bootloader-arduino/release/2024-09-05_110459/bootloader-arduino_nano-1284.elf index 1ea4d12cd6d81a2a9842f551487a55776059366b..547e7b656f70953e3815c4188a60cac9acec14bf 100755 GIT binary patch delta 21 ccmez3`^9&I0waf^p_PG&m8s=s4aPI7098c>(EtDd delta 21 ccmez3`^9&I0wafkxs`#jm5Iq_4aPI7098^3&j0`b diff --git a/software/bootloader-arduino/release/2024-09-05_070344/bootloader-arduino_nano-1284.hex b/software/nano-1284/bootloader-arduino/release/2024-09-05_110459/bootloader-arduino_nano-1284.hex similarity index 95% rename from software/bootloader-arduino/release/2024-09-05_070344/bootloader-arduino_nano-1284.hex rename to software/nano-1284/bootloader-arduino/release/2024-09-05_110459/bootloader-arduino_nano-1284.hex index d3e0a99..a903211 100644 --- a/software/bootloader-arduino/release/2024-09-05_070344/bootloader-arduino_nano-1284.hex +++ b/software/nano-1284/bootloader-arduino/release/2024-09-05_110459/bootloader-arduino_nano-1284.hex @@ -7,8 +7,8 @@ :10E050000C9463F00C9463F00C9463F00C9463F0F4 :10E060000C9463F00C9463F00C9463F00C9463F0E4 :10E070000C9463F00C9463F00C9463F00C9463F0D4 -:10E080000C9463F00C9463F00C9463F030373A30E6 -:10E09000333A343400536570202035203230323426 +:10E080000C9463F00C9463F00C9463F031313A30EB +:10E09000343A35390053657020203520323032341F :10E0A000000011241FBECFEFD0E4DEBFCDBF22E0C1 :10E0B000A0E0B1E001C01D92AC30B207E1F70E94D0 :10E0C00048F10C9434F30C9400F09091C00095FF4B diff --git a/software/bootloader-arduino/src/main.c b/software/nano-1284/bootloader-arduino/src/main.c similarity index 92% rename from software/bootloader-arduino/src/main.c rename to software/nano-1284/bootloader-arduino/src/main.c index 39275a2..b93774c 100644 --- a/software/bootloader-arduino/src/main.c +++ b/software/nano-1284/bootloader-arduino/src/main.c @@ -38,16 +38,6 @@ #define SET_LED_GREEN (PORTC |= (1 << PC4)) #define CLR_LED_GREEN (PORTC &= ~(1 << PC4)) -// define various device id's -// manufacturer byte is always the same -#define SIG1 0x1E // Yep, Atmel is the only manufacturer of AVR micros. Single source :( -#define SIG2 0x97 -#define SIG3 0x05 -#define PAGE_SIZE 0x80U // 128 words - -volatile const char DATE[] PROGMEM = __DATE__; -volatile const char TIME[] PROGMEM = __TIME__; - // function prototypes void putch(char); char getch(void); @@ -58,6 +48,9 @@ char gethex(void); void puthex(char); void flash_led(uint8_t); +volatile const char DATE [] PROGMEM = __DATE__; +volatile const char TIME [] PROGMEM = __TIME__; + #ifdef DEBUG_UART1 int uart_putchar(char c, FILE *stream) { if (c == '\n') { @@ -118,7 +111,7 @@ int main () { // LED ports output and off, ensure that Q1 (battery power) on (PC7) PORTC = 0; - DDRC = (1 << PC7) | (1 << PC4) | (1 << PC3) |(1 << PC2); + DDRC = (1 << PC7) | (1 << PC4) | (1 << PC3) |(1 << PC2); #ifdef DOUBLE_SPEED @@ -251,11 +244,11 @@ int main () { ch = getch(); getch(); if (ch == 0) { - byte_response(SIG1); + byte_response(SIGNATURE_0); } else if (ch == 1) { - byte_response(SIG2); + byte_response(SIGNATURE_1); } else { - byte_response(SIG3); + byte_response(SIGNATURE_2); } } else { getNch(3); @@ -290,12 +283,14 @@ int main () { } } else { // Write to FLASH one page at a time - if (address.byte[1] > 127) { - //Only possible with m128, m256 will need 3rd address byte. FIXME - RAMPZ = 0x01; - } else { - RAMPZ = 0x00; - } + #ifdef RAMPZ + if (address.byte[1] > 127) { + //Only possible with m128, m256 will need 3rd address byte. FIXME + RAMPZ = 0x01; + } else { + RAMPZ = 0x00; + } + #endif // address * 2 -> byte location address.word = address.word << 1; @@ -375,11 +370,15 @@ int main () { address.word++; } else { - if (!flags.rampz) { - putch(pgm_read_byte_near(address.word)); - } else { - putch(pgm_read_byte_far(address.word + 0x10000)); - } + #ifdef RAMPZ + if (!flags.rampz) { + putch(pgm_read_byte_near(address.word)); + } else { + putch(pgm_read_byte_far(address.word + 0x10000)); + } + #else + putch(pgm_read_byte_near(address.word)); + #endif address.word++; } } @@ -390,9 +389,9 @@ int main () { // Get device signature bytes if (getch() == ' ') { putch(0x14); - putch(SIG1); - putch(SIG2); - putch(SIG3); + putch(SIGNATURE_0); + putch(SIGNATURE_1); + putch(SIGNATURE_2); putch(0x10); } else { if (++error_count == MAX_ERROR_COUNT) -- 2.39.5