/Designs/MRAKOMER4/SW/bootloader/bloader.PJT
1,36 → 1,23
[Directories]
Include=C:\Program Files\PICC\Devices;C:\Program Files\PICC\Drivers;
Library=
LinkerScript=
[defines]
enabled=0
D1=
V1=
[fileformats]
forcecoff=0
debug=4
error=2
object=0
list=0
scratch=0
sta=1
tre=1
allerrors=1
allwarnings=1
stayupne=3
stayupoe=0
[PROJECT]
Target=bloader.hex
Target=main.HEX
Development_Mode=
Processor=0x688F
ToolSuite=CCS
Processor_Text=PIC16F88
ToolSuite=CCS
 
[Directories]
Include=C:\Program Files\PICC\devices\;C:\Program Files\PICC\dr
Library=
LinkerScript=
 
[Target Data]
FileList=C:\Dokumenty\MLAB\Designs\MRAKOMER4\SW\bootloader\bloader.c
BuildTool=C-COMPILER
OptionString=+FM
AdditionalOptionString=
BuildRequired=1
[bloader.c]
 
[main.c]
Type=4
Path=
FileList=
37,19 → 24,22
BuildTool=
OptionString=
AdditionalOptionString=
 
[mru-list]
1=bloader.c
1=main.c
 
[Windows]
0=0000 %S 0 0 796 451 3 0
0=0000 main.c 0 0 796 451 3 0
 
[Opened Files]
1=C:\Dokumenty\MLAB\Designs\MRAKOMER4\SW\bootloader\bloader.c
2=C:\Dokumenty\MLAB\Designs\MRAKOMER4\SW\bootloader\bloader.h
3=C:\Program Files\PICC\devices\16F88.h
4=C:\Dokumenty\MLAB\Designs\MRAKOMER4\SW\bootloader\bloader.lst
5=
6=
7=
8=
[Units]
Link=0
Count=1
1=bloader.c
[Opened Files]
1=bloader.c
2=bloader.h
3=..\..\..\..\..\..\..\..\Program Files\PICC\Devices\16F88.h
4=..\..\..\..\..\..\..\..\Program Files\PICC\Drivers\string.h
5=..\..\..\..\..\..\..\..\Program Files\PICC\Drivers\stddef.h
6=..\..\..\..\..\..\..\..\Program Files\PICC\Drivers\ctype.h
7=
1=C:\Dokumenty\MLAB\Designs\MRAKOMER4\SW\bootloader\bloader.c (main)
/Designs/MRAKOMER4/SW/bootloader/bloader.c
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;