1,18 → 1,9 |
/**** BootLoader ****/ |
#define VERSION "1.1" |
#define VERSION "1.0" |
#define ID "$Id$" |
|
#CASE // Case sensitive compiler |
|
#define FLASH_BLOCK_SIZE 32 |
#define BLOADER_MAIN_LENGTH 139 // Rezervovane misto pro main BootLoaderu |
#define RESERVED_BLOCKS 24 // Pocet rezervovanych bloku Flash pro BootLoader |
#define LOADER_RESERVED getenv("PROGRAM_MEMORY")-RESERVED_BLOCKS*FLASH_BLOCK_SIZE |
#define BUFFER_LEN_LOD 46 |
#if FLASH_BLOCK_SIZE != getenv("FLASH_ERASE_SIZE")/2 |
#error Wrong length of the Flash Block Size. getenv("FLASH_ERASE_SIZE")/getenv("FLASH_WRITE_SIZE") |
#endif |
|
#include "bloader.h" |
#include <string.h> |
|
23,7 → 14,7 |
|
|
#INT_RDA |
void rs232_handler() |
rs232_handler() |
{ |
putchar(getc()); |
} |
34,8 → 25,8 |
char VER[4]=VERSION; // Buffer for concatenate of a version string |
|
if (REV[strlen(REV)-1]=='$') REV[strlen(REV)-1]=0; |
printf("\r\n\r\n# BLoader %s (C) 2007 KAKL\r\n",VER); // Welcome message |
printf("#%s\r\n",&REV[4]); |
printf("\n\r\n\r# BLoader %s (C) 2007 KAKL\n\r",VER); // Welcome message |
printf("#%s\n\r",&REV[4]); |
} |
|
|
47,9 → 38,7 |
|
welcome(); |
|
printf("# Reserved: %Lu\r\n", RESERVED_BLOCKS*FLASH_BLOCK_SIZE); |
|
printf("# Boot Loader Test >>>\r\n# "); |
printf("# Boot Loader Test >>>\n\r# "); |
enable_interrupts(INT_RDA); |
enable_interrupts(GLOBAL); |
while(TRUE) |
61,7 → 50,14 |
|
|
/*------------------- BOOT LOADER --------------------------------------------*/ |
#define FLASH_BLOCK_SIZE 32 |
#define LOADER_RESERVED getenv("PROGRAM_MEMORY")-26*FLASH_BLOCK_SIZE |
#define BUFFER_LEN_LOD 46 |
#if FLASH_BLOCK_SIZE != getenv("FLASH_ERASE_SIZE")/2 |
#error Wrong length of the Flash Block Size. getenv("FLASH_ERASE_SIZE")/getenv("FLASH_WRITE_SIZE") |
#endif |
|
|
#BUILD(INTERRUPT=FLASH_BLOCK_SIZE) // Redirect Interrupt routine above first flash block |
#ORG 4,5 |
void JumpToTheInterrupt() // Jump to the Interrupt Handler |
76,7 → 72,7 |
real_main(); |
} |
|
#ORG LOADER_RESERVED+FLASH_BLOCK_SIZE,getenv("PROGRAM_MEMORY")-BLOADER_MAIN_LENGTH auto=0 default |
#ORG LOADER_RESERVED+FLASH_BLOCK_SIZE,getenv("PROGRAM_MEMORY")-130 auto=0 default |
|
unsigned int atoi_b16(char *s) // Convert two hex characters to an int8 |
{ |
111,7 → 107,7 |
} |
|
#SEPARATE |
void boot_loader() |
boot_loader() |
{ |
int buffidx; |
char buffer[BUFFER_LEN_LOD]; |
121,7 → 117,7 |
int16 addr; |
int32 next_addr; |
|
int8 dataidx, i; |
int8 dataidx, i, count; |
union program_data { |
int8 i8[16]; |
int16 i16[8]; |
221,7 → 217,7 |
|
#ORG default |
|
#ORG getenv("PROGRAM_MEMORY")-BLOADER_MAIN_LENGTH+1,getenv("PROGRAM_MEMORY")-1 auto=0 |
#ORG getenv("PROGRAM_MEMORY")-129,getenv("PROGRAM_MEMORY")-1 auto=0 |
void main() |
{ |
int8 timeout; |