It can be deleted using "ERASE SECTOR" the area on the bootloader?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

It can be deleted using "ERASE SECTOR" the area on the bootloader?

跳至解决方案
972 次查看
Microfelix
Contributor IV

I would like to replace my bootloader on the devices already in production.

I would make it through firmware upgrades.

But as soon as I try to clear the field, it gives me error.

I set FLASHX = 1.

The sector is protected.

I can not find a wild solution.

Is there any solution?

Thanks for answers.

MQX 4.0.2 MK70 CW 10.4

Maurizio

0 项奖励
1 解答
646 次查看
Microfelix
Contributor IV

hi David.

No I have different versions of silicon.

I'm always working with my prototype that works with both MQX3.8 and MQX4.0.2.

I was able, to solve the problem. going deeper in the research, I discovered that the real problem was the initialization of the watchdog.

In the second version of bootloader (which works), initialize the watchdog at the beginning of the firmware. While in the first version of bootloader, no.

In fact, I included in the routine "__init_registers" dell'MQX 4.0.2 this routine "_bsp_watchdog_disable" and now works with both MQX3.8 that MQX4.0.2

Maurizio

在原帖中查看解决方案

0 项奖励
10 回复数
647 次查看
Microfelix
Contributor IV

hi David.

No I have different versions of silicon.

I'm always working with my prototype that works with both MQX3.8 and MQX4.0.2.

I was able, to solve the problem. going deeper in the research, I discovered that the real problem was the initialization of the watchdog.

In the second version of bootloader (which works), initialize the watchdog at the beginning of the firmware. While in the first version of bootloader, no.

In fact, I included in the routine "__init_registers" dell'MQX 4.0.2 this routine "_bsp_watchdog_disable" and now works with both MQX3.8 that MQX4.0.2

Maurizio

0 项奖励
646 次查看
DavidS
NXP Employee
NXP Employee

Great.  Glad you are up and running.  Good debugging.

Regards,

David

0 项奖励
646 次查看
DavidS
NXP Employee
NXP Employee

Hi Maurizio,

Have you checked what the Flash configuration bits are set to from 0x400-410?

The flash contains a 16-byte flash configuration field that is used to store some default settings
for the flash.

The flash configuration field is located in the flash array from 0x400 – 0x410 (usually placed at the
end of the vector table).

During reset, values from these memory locations are copied into some of the flash registers to define
the default configuration.

ScreenHunter_31 Sep. 16 09.38.gif

Chapter 8 speaks of flash security and Chapter 30 has the bit definitions in the K70P256M150SF3RM.pdf (Rev2).

Regards,

David

0 项奖励
646 次查看
Microfelix
Contributor IV

Hello David,
thanks for the reply.
I had already read through Chapter 30, however, I can not understand how can I erase sector 0 after locking. I thought the backdoor, but I do not know if it is correct.
At first I thought that the protection was only for the outside. To prevent someone reads the firmware. but instead I find it difficult to update the boot loader.
However, the byte you are referring to, my bootloader has set them like this:

0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFE, 0xFFFFFFFE

What do you suggest?


ps.
My registry FTFE = 0xFE


Maurizio

0 项奖励
646 次查看
DavidS
NXP Employee
NXP Employee

Hi Maurizio,

Ouch....the bitfield described indicates to me that the sector 0 is flash protected.

After the protection register default values are loaded at reset, protection can only be increased.....this means that you can’t disable protection for a given region of flash at run time.
If the flash region that contains the flash configuration fields is protected, then a mass erase is required before any of the flash configuration fields can be changed.

Regards,

David

0 项奖励
646 次查看
Microfelix
Contributor IV

Hello David,
I can erase the sector, with this configuration, if I program with Jlink (SEGGER).
If, however, the programs, and through programmer CYCLONEMAX happens that I can not erase the sector.



maurizio

0 项奖励
646 次查看
DavidS
NXP Employee
NXP Employee

Hi Maurizio,

Correct and I apologize for not being clearer.  From the code execution point of view the flash protection cannot be changed from protected sector to un-protected sector.  It can however be temporarily protected and then on reset revert back to a non-protected sector.

Using development tools when the flash sector is protected is valid as long as the mass erase bit is cleared to allow a mass erase of the entire flash.  Then whatever you want to program is OK.

If the JLink interface is working but not the CYCLONEMAX, then I suspect a configuration setting for that tool is not setup.  Best to ping P&E Micro for that help.  I do not have a CYCLONEMAX to test with.  Sorry.

Regards,

David


0 项奖励
647 次查看
Microfelix
Contributor IV

Thanks david for the time.
Second test.
All my work, research to change the bootloader, is due to the fact that my bootloader, AN2295, worked very well with the MQX 3.8.
But since I switched to 4.0.2 (MQX best for me), I can not get my bootloader (AN2295 original).
To make it work, I had to comment on 2 lines:

   SIM_SCGC1 | = SIM_SCGC1_UART4_MASK | SIM_SCGC1_UART5_MASK / / uart4 / 5 clock gate
   SIM_SCGC4 | = (SIM_SCGC4_UART0_MASK | SIM_SCGC4_UART1_MASK | SIM_SCGC4_UART2_MASK | SIM_SCGC4_UART3_MASK) / / Enables UARTs

Commenting on these 2 lines, my application works with MQX 4.0.2.
Why?

For this reason I thought to change the bootloader.
but in my opinion, the problem may be something in the MQX 4.0.2.


Maurizio

0 项奖励
647 次查看
DavidS
NXP Employee
NXP Employee

Hi Maurizio,

I read you post as you have it working but question why it is working.  Is that correct?

I do not know why those two lines make difference between using MQX3.8 and MQX4.0.2.  I would not think there would be difference because of MQX version.

But if you have different revision of silicon it might make sense.  Do you have different revisions of silicon?

Regards,

David

0 项奖励
647 次查看
Microfelix
Contributor IV

help help help

Maurizio

0 项奖励