AnsweredAssumed Answered

How to avoid CAN bootloader call the _COPY function.

Question asked by XY FAN on Jun 13, 2017
Latest reply on Jun 15, 2017 by Radek Sestak

Hi,

 

I am working with a MC9S12XEP100 CAN bootloader project. After compiled the project I found the bootloader used two function, _COPY and _CASE_CHECKED_BYTE.  These two functions are generated from rtshc12.c.o (ansixbi.lib). Because my bootloader uses these two functions. I can't erase the NON_BANKED segment, where these two functions located. Or my bootloader will die. That means I can't update the NON_BANKED segment.

 

I want to ask is there any way to avoid my bootloader using these two functions. In order to let me update NON_BANKED segment as well as user application.

 

Thanks.

 

Here's some segment of my project.

void CanStatusAck(UINT8 sta)
{
TxMsg.ID = UpLoadID;
TxMsg.DtLen = 1;
TxData[0] = sta;
TxMsg.data=(UINT8 *)&TxData[0];

/*It looks like the _COPY function is called there*/
(void)CanTxFrame(TxMsg);
}

 

UINT8 CanTxFrame(CanMsg_t msg)
{
unsigned char send_buf, sp;
if(msg.DtLen > 8)
return(FALSE);

 

if(CAN0CTL0_SYNCH==0)
return(FALSE);

 

send_buf = 0;

do
{
CAN0TBSEL=CAN0TFLG;
send_buf=CAN0TBSEL;
}
while(!send_buf);
CAN0TXIDR0 = (unsigned char)(msg.ID>>3);
CAN0TXIDR1 = (unsigned char)(msg.ID<<5);

for(sp = 0; sp < msg.DtLen; sp++)
*((&CAN0TXDSR0)+sp) = msg.data[sp];

CAN0TXDLR = msg.DtLen;

CAN0TFLG = send_buf;

return(TRUE);
}

 

Outcomes