Hi,
yesterday I have problem with compatibility version 2.0.7.3 with 2.0.7.7.
chip: atmega128A
I have programmed on chip bootloader, similar like bootloader in SAMPLE. They are compiled on BASCOM 2.0.7.3
The loader wait for dollar sign ($), if they receive nothing, bootloader send quotation sign (?).
[code:1:aac92f9a00]
'----------------------------------------------------------------
$loader = &HFC00
$crystal = 16000000
$baud = 57600 'this loader uses serial com
$initmicro
$regfile = "m128def.dat"
Config Com1 = Dummy , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0
Const Maxwordbit = 7 'Z7 is maximum bit
Const Maxword =(2 ^ Maxwordbit) * 2 '128
Const Maxwordshift = Maxwordbit + 1
Const Cdebug = 0 ' leave this to 0
'Dim the used variables
$prog &HFF , &H1F , &H84 , &HFF ' generated. Take care that the chip supports all fuse bytes.
Dim Bstatus As Byte , Bretries As Byte , Bblock As Byte , Bblocklocal As Byte
Dim Bcsum1 As Byte , Bcsum2 As Byte , Buf(128) As Byte , Csum As Byte
Dim J As Byte , Spmcrval As Byte ' self program command byte valueDim Z As Long 'this is the Z pointer word
Dim Vl As Byte , Vh As Byte ' these bytes are used for the data values
Dim Wrd As Word , Page As Word 'these vars contain the page and word address
Dim Bkind As Byte , Bstarted As Byte
Disable Interrupts 'we do not use ints
'some constants used in serial com
Const Nak = &H15
Const Ack = &H06
Const Can = &H18
'we use some leds as indication in this sample , you might want to remove it
Config Pinb.7 = Output
Portb.7 = 1
$timeout = 400000
Bstarted = 0
Do
J = Waitkey()
If J = 36 Then
Goto Loader
End If
Print "?";
Incr Bstarted
Loop Until Bstarted > 2[/code:1:aac92f9a00]
The Loader label is similar like in SAMPLES.
The communication chip with computer is Com1: 57600,8,N,1,none
In the main program start the bootloader is
[code:1:aac92f9a00]
Case 36: '$ - bootloader
Print "$"
Goto &HFC00
[/code:1:aac92f9a00]
In the old version (compiled on BASCOM 2.0.7.3) if I send on com1 "$", I receive "$???" and chip restart (The main program send "$" and jump to &HFC00, the loader section. The bootloader wait for another "$". If they don't recive, send "?"). On the new version (BASCOM 2.0.7.7) if i send "$", i recive "$űűű" and chip restarts.
In the maim program com1 is buffered and maybe that is the problem. But in the older version that is no problem.
$loadersize is setup on 1024 and 2048 and it is no mater.The main program size is 16% memory.
in the chips fuses is setup on bootloader 1024.
It looks like the communication protocol is different. I expect h24, but i receive hFB. The firs sign ($) is Ok, because they are send in the main program.
If I recompiled bootloader on the newer version bascom, they work perfect with new firmware main program.
But i have hundreds in my customer, and i need compatibility to down version boot loader.
The quite weird is that, the bootloader is on the chip saved on h1F800, but I set the $loader=&hFC00 and in the chip fuses is setup on hFC00. And the best is , that the size of the bootloader is bigger than 1024. Maybe that is the problem, but why this work on the later version compiler.
Any suggestions?
[b:aac92f9a00][color=red:aac92f9a00](BASCOM-AVR version : 2.0.7.7 )[/b:aac92f9a00][/color:aac92f9a00]
↧