New lang, arduino 1.8.5 - boot_app debug output

+ variable _uartout linkage fix
+ DEBUG_DCODE5
This commit is contained in:
Robert Pelnar 2018-10-18 16:20:14 +02:00
parent 563052d015
commit ac18eb67c0
5 changed files with 41 additions and 25 deletions

View file

@ -142,7 +142,6 @@ void dcode_3()
} }
#endif //DEBUG_DCODE3 #endif //DEBUG_DCODE3
#ifdef DEBUG_DCODES
#include "ConfigurationStore.h" #include "ConfigurationStore.h"
#include "cmdqueue.h" #include "cmdqueue.h"
@ -150,8 +149,9 @@ void dcode_3()
#include "adc.h" #include "adc.h"
#include "temperature.h" #include "temperature.h"
#include <avr/wdt.h> #include <avr/wdt.h>
#include "bootapp.h"
/*
#define FLASHSIZE 0x40000 #define FLASHSIZE 0x40000
#define RAMSIZE 0x2000 #define RAMSIZE 0x2000
@ -172,6 +172,8 @@ extern float axis_steps_per_unit[NUM_AXIS];
//#define LOG(args...) printf(args) //#define LOG(args...) printf(args)
#define LOG(args...) #define LOG(args...)
*/
#ifdef DEBUG_DCODES
void dcode__1() void dcode__1()
{ {
@ -279,10 +281,13 @@ void dcode_4()
} }
} }
} }
/* #endif //DEBUG_DCODES
#ifdef DEBUG_DCODE5
void dcode_5() void dcode_5()
{ {
LOG("D5 - Read/Write FLASH\n"); printf_P(PSTR("D5 - Read/Write FLASH\n"));
uint32_t address = 0x0000; //default 0x0000 uint32_t address = 0x0000; //default 0x0000
uint16_t count = 0x0400; //default 0x0400 (1kb block) uint16_t count = 0x0400; //default 0x0400 (1kb block)
if (code_seen('A')) // Address (0x00000-0x3ffff) if (code_seen('A')) // Address (0x00000-0x3ffff)
@ -306,17 +311,11 @@ void dcode_5()
{ {
if (bErase) if (bErase)
{ {
LOG(count, DEC); printf_P(PSTR("%d bytes of FLASH at address %05x will be erased\n"), count, address);
LOG(" bytes of FLASH at address ");
print_hex_word(address);
putchar(" will be erased\n");
} }
if (bCopy) if (bCopy)
{ {
LOG(count, DEC); printf_P(PSTR("%d bytes will be written to FLASH at address %05x\n"), count, address);
LOG(" bytes will be written to FLASH at address ");
print_hex_word(address);
putchar('\n');
} }
cli(); cli();
boot_app_magic = 0x55aa55aa; boot_app_magic = 0x55aa55aa;
@ -324,6 +323,7 @@ void dcode_5()
boot_copy_size = (uint16_t)count; boot_copy_size = (uint16_t)count;
boot_dst_addr = (uint32_t)address; boot_dst_addr = (uint32_t)address;
boot_src_addr = (uint32_t)(&data); boot_src_addr = (uint32_t)(&data);
bootapp_print_vars();
wdt_enable(WDTO_15MS); wdt_enable(WDTO_15MS);
while(1); while(1);
} }
@ -344,7 +344,9 @@ void dcode_5()
putchar('\n'); putchar('\n');
} }
} }
*/ #endif //DEBUG_DCODE5
#ifdef DEBUG_DCODES
void dcode_6() void dcode_6()
{ {

View file

@ -64,7 +64,10 @@
#include "lcd.h" #include "lcd.h"
extern "C" {
extern FILE _uartout; extern FILE _uartout;
}
#define uartout (&_uartout) #define uartout (&_uartout)
#define SERIAL_PROTOCOL(x) (MYSERIAL.print(x)) #define SERIAL_PROTOCOL(x) (MYSERIAL.print(x))

View file

@ -920,8 +920,9 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
} }
extern "C" {
FILE _uartout = {0}; FILE _uartout = {0};
}
int uart_putchar(char c, FILE *stream) int uart_putchar(char c, FILE *stream)
{ {
@ -1575,7 +1576,7 @@ void setup()
uint16_t ui = _SEC_LANG_TABLE; //table pointer uint16_t ui = _SEC_LANG_TABLE; //table pointer
printf_P(_n("lang_selected=%d\nlang_table=0x%04x\nSEC_LANG_CODE=0x%04x (%c%c)\n"), lang_selected, ui, sec_lang_code, sec_lang_code >> 8, sec_lang_code & 0xff); printf_P(_n("lang_selected=%d\nlang_table=0x%04x\nSEC_LANG_CODE=0x%04x (%c%c)\n"), lang_selected, ui, sec_lang_code, sec_lang_code >> 8, sec_lang_code & 0xff);
// lang_print_sec_lang(uartout); lang_print_sec_lang(uartout);
#endif //DEBUG_SEC_LANG #endif //DEBUG_SEC_LANG
#endif //(LANG_MODE != 0) #endif //(LANG_MODE != 0)
@ -6959,9 +6960,13 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
#ifdef DEBUG_DCODES #ifdef DEBUG_DCODES
case 4: // D4 - Read/Write PIN case 4: // D4 - Read/Write PIN
dcode_4(); break; dcode_4(); break;
#endif //DEBUG_DCODES
#ifdef DEBUG_DCODE5
case 5: // D5 - Read/Write FLASH case 5: // D5 - Read/Write FLASH
// dcode_5(); break; dcode_5(); break;
break; break;
#endif //DEBUG_DCODE5
#ifdef DEBUG_DCODES
case 6: // D6 - Read/Write external FLASH case 6: // D6 - Read/Write external FLASH
dcode_6(); break; dcode_6(); break;
case 7: // D7 - Read/Write Bootloader case 7: // D7 - Read/Write Bootloader

View file

@ -5,17 +5,20 @@
#include <avr/interrupt.h> #include <avr/interrupt.h>
/* #include <stdio.h>
void bootapp_print_vars() extern FILE _uartout;
#define uartout (&_uartout)
void bootapp_print_vars(void)
{ {
printf_P(_n("boot_src_addr =0x%08lx\n"), boot_src_addr); fprintf_P(uartout, PSTR("boot_src_addr =0x%08lx\n"), boot_src_addr);
printf_P(_n("boot_dst_addr =0x%08lx\n"), boot_dst_addr); fprintf_P(uartout, PSTR("boot_dst_addr =0x%08lx\n"), boot_dst_addr);
printf_P(_n("boot_copy_size =0x%04x\n"), boot_copy_size); fprintf_P(uartout, PSTR("boot_copy_size =0x%04x\n"), boot_copy_size);
printf_P(_n("boot_reserved =0x%02x\n"), boot_reserved); fprintf_P(uartout, PSTR("boot_reserved =0x%02x\n"), boot_reserved);
printf_P(_n("boot_app_flags =0x%02x\n"), boot_app_flags); fprintf_P(uartout, PSTR("boot_app_flags =0x%02x\n"), boot_app_flags);
printf_P(_n("boot_app_magic =0x%08lx\n"), boot_app_magic); fprintf_P(uartout, PSTR("boot_app_magic =0x%08lx\n"), boot_app_magic);
} }
*/
void bootapp_ram2flash(uint16_t rptr, uint16_t fptr, uint16_t size) void bootapp_ram2flash(uint16_t rptr, uint16_t fptr, uint16_t size)
{ {
@ -35,6 +38,7 @@ void bootapp_ram2flash(uint16_t rptr, uint16_t fptr, uint16_t size)
boot_copy_size = (uint16_t)size; boot_copy_size = (uint16_t)size;
boot_src_addr = (uint32_t)rptr; boot_src_addr = (uint32_t)rptr;
boot_dst_addr = (uint32_t)fptr; boot_dst_addr = (uint32_t)fptr;
bootapp_print_vars();
wdt_enable(WDTO_15MS); wdt_enable(WDTO_15MS);
while(1); while(1);
} }
@ -45,6 +49,7 @@ void bootapp_reboot_user0(uint8_t reserved)
boot_app_magic = BOOT_APP_MAGIC; boot_app_magic = BOOT_APP_MAGIC;
boot_app_flags = BOOT_APP_FLG_USER0; boot_app_flags = BOOT_APP_FLG_USER0;
boot_reserved = reserved; boot_reserved = reserved;
bootapp_print_vars();
wdt_enable(WDTO_15MS); wdt_enable(WDTO_15MS);
while(1); while(1);
} }

View file

@ -28,6 +28,7 @@
extern "C" { extern "C" {
#endif //defined(__cplusplus) #endif //defined(__cplusplus)
extern void bootapp_print_vars(void);
extern void bootapp_ram2flash(uint16_t rptr, uint16_t fptr, uint16_t size); extern void bootapp_ram2flash(uint16_t rptr, uint16_t fptr, uint16_t size);