CRP1 and usb mass storage

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

CRP1 and usb mass storage

1,973 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by blasiis on Wed Sep 07 01:33:55 MST 2011
LPC1758 with LPCXPresso v.4
I have used the RDB1768cmsis_usb_bootloader library and I use it for usb mass storage device.
When work without protection all is ok.
When I active the CRP1, the application running, but, when I "drag and drop" a file on usb mass storage, the file is moved, but after off-on the file it isn't present !
With oscilloscope i have see that the SCSIHandleData is get faster !
Can help me ?
Thanks
0 项奖励
回复
10 回复数

1,932 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by blasiis on Thu Sep 15 04:56:32 MST 2011

Quote: CodeRedSupport
If you put the line...

[FONT=Courier New][SIZE=2]__CRP const unsigned int CRP_WORD = CRP_NO_CRP[/SIZE][/FONT]

in your code, then together with the changes to the linker script this should reserve a word for the CRP in your generated image, but the value placed in it is a "default" value which will not cause any form of CRP checking.

The value [FONT=Courier New][SIZE=2]CRP_NO_CRP[/SIZE][/FONT] is defined in the [FONT=Courier New][SIZE=2]crp.h[/SIZE][/FONT] header file. To view this header, just highlight the include in your source code, and pressing F3 should take you to it.

Regards,
CodeRedSupport.


Yes, I have understud all, I need to protect for default, for this reason I have used
[FONT=Courier New][SIZE=2]__CRP const unsigned int CRP_WORD = CRP_CRP1
[/SIZE][/FONT]
I don't eable only how can I verify that the chip is protected using LPCXPresso or Flashmagic.

Thanks
0 项奖励
回复

1,932 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Thu Sep 15 02:17:57 MST 2011
If you put the line...

[FONT=Courier New][SIZE=2]__CRP const unsigned int CRP_WORD = CRP_NO_CRP[/SIZE][/FONT]

in your code, then together with the changes to the linker script this should reserve a word for the CRP in your generated image, but the value placed in it is a "default" value which will not cause any form of CRP checking.

The value [FONT=Courier New][SIZE=2]CRP_NO_CRP[/SIZE][/FONT] is defined in the [FONT=Courier New][SIZE=2]crp.h[/SIZE][/FONT] header file. To view this header, just highlight the include in your source code, and pressing F3 should take you to it.

Regards,
CodeRedSupport.
0 项奖励
回复

1,932 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by blasiis on Wed Sep 14 01:31:35 MST 2011

Quote: whitecoe
And why don't you  get things working fully with CRP_WORD left at "CRP_NO_CRP" first? That way you'll be able to debug right up until the point when you are completely happy!


Sorry but I can not understand what you mean.

__CRP const unsigned int CRP_WORD = CRP_NO_CRP
. . . . . . . . . .
CRP_WORD = CRP_CRP1

Can you give me an example ?

Thanks
0 项奖励
回复

1,932 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by whitecoe on Tue Sep 13 07:57:26 MST 2011

Quote: blasiis

1) In main_bootloader.c added the reservation of bytes 2FC
#include "crp.h"
__CRP const unsigned int CRP_WORD = CRP_CRP1



I would suggest that you look at the linker map file or disassemble the image to see what is actually being generated using your modified linker script.

And why don't you  get things working fully with CRP_WORD left at "CRP_NO_CRP" first? That way you'll be able to debug right up until the point when you are completely happy!

HTH!
0 项奖励
回复

1,932 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by blasiis on Tue Sep 13 01:07:04 MST 2011
I have read the documentation.
I have make this modification:

1) In main_bootloader.c added the reservation of bytes 2FC
#include "crp.h"
__CRP const unsigned int CRP_WORD = CRP_CRP1

2) The linker script is modified  :
    .text :
    {
        KEEP(*(.isr_vector))
   . = 0x000002FC ;
                KEEP(*(.crp))
        *(.text*)
        *(.rodata*)

    } > MFlash512

I have program the flash with LPCXPRESSO 4 and CRP enabled = CRP1
Now all work correctly but the flash it is protected ?
For verify if the flash is protected i have:
1) with CRP1 I have try to delete or reprogram the flash by LPCXPRESSO, It is possible !!
2) Read the security by flashmagic : No CRP !

Therefore I believe that the flash is not protected !!

How can i sure that the flash is protected ?If my flash is not protected even where I'm wrong ?

Thank all
0 项奖励
回复

1,932 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Fri Sep 09 05:20:53 MST 2011
So did you actually reserve a word at 0x2fc in the generated image for the CRP word to be written into by the flash programmer? If you look at the linker scripts and map file for the RDB1768 bootloader project, you will see that it does not do this by default.

So unless you made the appropriate change you are probably overwriting an instruction in the image as you download it - which could quite easily cause the behaviour that you are seeing. So again I say - read the docs on CRP! ;)

A good starting point which contains pointers to various other sources is:

http://support.code-red-tech.com/CodeRedWiki/CodeReadProtect

Regards,
CodeRedSupport
0 项奖励
回复

1,932 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by blasiis on Thu Sep 08 04:34:45 MST 2011
I have my bootloader application and I need to protect it.
For protect i have set the CPR1 box in window.When the flash is protected CRP1, the bootloader can not write flash!
0 项奖励
回复

1,932 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Thu Sep 08 04:19:13 MST 2011
Sorry. Can you please explain exactly what you are doing and what you are trying to achieve? The flash programmer GUI within the IDE has nothing to do with the USB bootloader.

[B]Important Note - before making use of CRP (Code Read Protect), you are strongly advised to  read NXP's documentation on this functionality. You should take  particular care as some CRP settings can disable some or all means of  access to your MCU (including debug).[/B]

Regards,
CodeRedSupport
0 项奖励
回复

1,932 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by blasiis on Thu Sep 08 02:40:25 MST 2011
I have only insert CRP1 in the Program Flash windows.
I don't have modified the code, only changed the "CRP selection" box and then programmed the chip with the same windows.

Thanks
0 项奖励
回复

1,932 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Thu Sep 08 01:45:24 MST 2011

Quote: blasiis

When I active the CRP1, the application running, but, when I "drag and drop" a file on usb mass storage, the file is moved, but after off-on the file it isn't present !



Where exactly have you activated CRP1?

Have you just set the CRP word in  the bootloader application itself? Have you added the CRP word to the  application being placed into flash via the bootloader? Have you added  some support into the bootloader for handling applications with CRP enabled?

In the first place, I would suggest that you take a look at NXP's application note  AN10866 "LPC1700 secondary USB bootloader"- which, as documented in the readme, is what the RDB bootloader is based on (but the RDB version does not implement the CRP support that the application note discusses).

Regards,
CodeRedSupport
0 项奖励
回复