Bootloader with DZ60

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Bootloader with DZ60

1,564 Views
Francois
Contributor I

Hello,

 

I'm new with DZ 60 and I've found several very interested informations on the forum but I've a little problem

for building a serial bootloader. I'm not very familiar with assembler and prefer C. 

 

1) We want to send the .mot (or .s19) file to SCI1 (full duplex) with terminal (or hyperterminal) on Windows.

We use XON/XOFF software protocol to wait for programmation of Flash.

I've built that bootloader (~800 bytes) and I must copy it in Ram then jump to it.

My problem is that all the long jumps in that bootloader are directed in ROM and not in RAM.

I've use the maximum of INLINE functions but relatives jumps are 128 bytes at maximum.

How can I change the adresses of these long jumps ? Or how can I force the compiler not to use 

long jumps ?

I thought to write this bootloader for the RAM and then place it into ROM, is it the good solution.

How can I shift a part of code from an adress to an other one ?

(After, I'll have to build an other bootloader for half duplex ModBus protocol but it'll be very similar)

 

2) When programming my device, the eeprom is always cleared (set to 0xFF)

I've tried the following but without succes :

- set the option for non programming EEPROM,

- indicate not to program the 0x1400 0x1800 area

- save the EEPROM contents when preload (the .s19 file is correctly stored)

but, in postload, when I recall the .s19 file, it doesn't load 

How can I recall my previous eeprom parameters ?

 

3) When I stop the debugger, it opens the file at the stop point, is there a way not to open this file 

and to stay in the current displayed file ?

 

Excuse me for my poor knowledge of DZ 60 and my poor english, if you need further informations,

don't hesitate to ask me

Regards

francois

Labels (1)
0 Kudos
2 Replies

435 Views
egoodii
Senior Contributor III

Linking code for execution 'elsewhere' is done with the linker command:

    COPY_ROM = READ_ONLY 0xEE26 TO 0xEEF2 RELOCATE_TO 0x0100;

 

    CODE_RAM = READ_WRITE 0x0100 TO 0x01CE;

With some appropriate segment names and #pragma sections,

 

    RAM_CODE INTO CODE_RAM;

    COPIED_CODE INTO COPY_ROM;

 this code moves it:

 

 

void copy_down(void) //Shift FLASH handling code that must run in RAM

{

    uint8_t *srcPtr, *dstPtr;

    uint16_t cnt;

    cnt = (u16_t)__SEG_SIZE_COPIED_CODE;

    srcPtr = (u8_t *)(u16_t)__SEG_START_COPIED_CODE;

    dstPtr = (u8_t *)(u16_t)&Do_Cmd;  //Locate linked entry point of first procedure

    do{

        *dstPtr++ = *srcPtr++;

    }while( --cnt> 0 );

}

0 Kudos

435 Views
bigmac
Specialist III

Hello,

 

I note that the 'DZ series does have two independent flash arrays, one for program flash and the other array for the EEPROM flash.  Therefore, while it will do no harm, it should be unnecessary to transfer and run any code from RAM, specifically for this type.

 

The flash programming function could be located in EEPROM flash, and the EEPROM programming function within program flash array.

 

Regards,

Mac

 

0 Kudos