Also successful run ccs "ex_pcd_aux_bootloader" but when load wrong hex file bootloader crashes and I have to load bootloader img. again with ICD U64 programmer.

I tried to use #fuse AWRT,APROTECT but serial bootloader does't start.

Thanks!

Ttelmah

Joined: 11 Mar 2010Posts: 12738

Posted: Sun Feb 25, 2018 12:49 pm

Your chip does not support boot segment protection.
Just modify the bootloader, so it won't write to the memory area where your bootloader sits. Just check the address when received and if this falls into the area where the bootloader sits, don't load the data.

Are you compiling your runtime code to work with the auxiliary bootloader?. As in the example ex_pcd_aux_bootload.c. Otherwise your code will be written to work in the primary memory, and not boot 'through' the auxiliary memory.

Then key is that it is the bootloader that needs to be written with the fuses set to protect itself, not the code you load.

kmp84

Joined: 02 Feb 2010Posts: 163

Posted: Mon Feb 26, 2018 3:59 am

Hi,

Quote:

Are you compiling your runtime code to work with the auxiliary bootloader?.

Yes, I have added in my application code:

Code:

//This is a necessary include file. It reserves space so that the
//bootloader is not overwritten.
#include <pcd_bootloader.h>

But the main problem is that bootloader crashes when load incorrect hex file and how to protect bootloader code space from read/write, unless it is erased!

Without also setting APLK.
If I remember correctly (another device), unless the APLK bits match the AWRT/APROTECT bits, it security locks the device. Only a bulk erase can then re-program it.

So:

Code:

#fuses AWRT,APROTECT, APLK

Which then protects the auxiliary segment, without enabling the device lock.

I hope this is the same on the device you have.

kmp84

Joined: 02 Feb 2010Posts: 163

Posted: Mon Feb 26, 2018 5:00 am

With this fuse settings still no success:

Code:

#fuses NOJTAG,NOWDT,RESET_AUX,AWRT,APROTECT,APLK

Bootloader does not start.

CCS C Compiller ver. 5.061

Ttelmah

Joined: 11 Mar 2010Posts: 12738

Posted: Mon Feb 26, 2018 5:14 am

I suggest you talk to CCS.
My guess is that the problem is the jump from general segment to auxiliary. This is only allowed to go to the last 32 instructions of the segment, when you are in high security mode (which is what you are enabling for this segment). You are probably going to have to force the bootloader vector to be in this area, rather than it's default location. A jump to anywhere else will cause a GPF, so the code won't run....