Sign in

username:

password:



Not a member?

Search lpc2000



Search tips

Subscribe to lpc2000



lpc2000 by Keywords

2106 | ADC | ARM7 | Atmel | Bootloader | CAN | CrossStudio | CrossWorks | DDS | ECos | Ethernet | ETM | FIFO | FLASH | FPGA | GCC | GDB | GNU | GNUARM | GPIO | I2C | IAP | IAR | JTAG | Kickstart | LCD | Linux | LPC | LPC-E2294 | LPC2000 | LPC2100 | LPC2104 | Lpc2106 | Lpc210x | LPC2114 | LPC2119 | LPC2124 | LPC2129 | Lpc2138 | LPC213x | LPC21xx | LPC2210 | LPC2212 | LPC2214 | LPC2292 | LPC2294 | LPC2xxx | LPC3128 | MCB2100 | Olimex | Philips | PWM | Rowley | RTC | RTOS | SPI | SSP | UART | UART0 | UART1 | ULINK | USB | Watchdog | Wiggler

Ads

Discussion Groups

Discussion Groups | LPC2000 | How to protect code in LPC2129

Discussion group dedicated to the Philips LPC2000 family of ARM MCUs

How to protect code in LPC2129 - r_goncalves2000 - Feb 16 10:22:00 2006

Hi,

I'm devoloping a aplication in LPC2129 and I want to protect
the code from reading.
I read the manual but still have some doubts:

1. Can I program the LPC2129 and then protect it from code reading
by writing the value 0x87654321 in position 0x1FC using Philips
LPC2000 Flash Utility? How to do that?

2. After protecting the LPC can I erase it and reprogram it?

Thanks.
Rui Gonçalves
	


(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )


Re: How to protect code in LPC2129 - Karl Olsen - Feb 16 11:20:00 2006

--- In lpc2000@lpc2..., "r_goncalves2000" <rpsgoncalves@...> 
wrote:

> I'm devoloping a aplication in LPC2129 and I want to protect
> the code from reading.
> I read the manual but still have some doubts:
> 
> 1. Can I program the LPC2129 and then protect it from code reading
> by writing the value 0x87654321 in position 0x1FC using Philips
> LPC2000 Flash Utility? How to do that?

Address 0x1FC is normally in the middle of your program, and you 
should not overwrite it from the Flash Utility unless you absolutely 
know that that location is unused.
See http://groups.yahoo.com/group/lpc2000/message/11515
	> 2. After protecting the LPC can I erase it and reprogram it?

Yes.

Karl Olsen
	


(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: Re: How to protect code in LPC2129 - Felipe Fontoura - Feb 16 11:48:00 2006

Hi,

I need the some information for LPC2138 <-

Tks to all

2006/2/16, Karl Olsen <kro@kro@...>:
>
>  --- In lpc2000@lpc2..., "r_goncalves2000" <rpsgoncalves@...>
> wrote:
>
> > I'm devoloping a aplication in LPC2129 and I want to protect
> > the code from reading.
> > I read the manual but still have some doubts:
> >
> > 1. Can I program the LPC2129 and then protect it from code reading
> > by writing the value 0x87654321 in position 0x1FC using Philips
> > LPC2000 Flash Utility? How to do that?
>
> Address 0x1FC is normally in the middle of your program, and you
> should not overwrite it from the Flash Utility unless you absolutely
> know that that location is unused.
> See http://groups.yahoo.com/group/lpc2000/message/11515
>
>
> > 2. After protecting the LPC can I erase it and reprogram it?
>
> Yes.
>
> Karl Olsen
>
>
>
>
>
>
>  SPONSORED LINKS
>  
Microcontrollers<http://groups.yahoo.com/gads?t=ms&k=Microcontrollers&w1=Microcontrollers&w2=Microprocessor&w3=Intel+microprocessors&w4=Pic+microcontrollers&c=4&s=95&.sig=mfaAujKZXA2Z_vxre9sGnQ>
>
Microprocessor<http://groups.yahoo.com/gads?t=ms&k=Microprocessor&w1=Microcontrollers&w2=Microprocessor&w3=Intel+microprocessors&w4=Pic+microcontrollers&c=4&s=95&.sig=9jjd2D3GOLIESVQssLmLsA>
 Intel
>
microprocessors<http://groups.yahoo.com/gads?t=ms&k=Intel+microprocessors&w1=Microcontrollers&w2=Microprocessor&w3=Intel+microprocessors&w4=Pic+microcontrollers&c=4&s=95&.sig=OMnZuqMZX95mgutt4B-tDw>
  Pic
>
microcontrollers<http://groups.yahoo.com/gads?t=ms&k=Pic+microcontrollers&w1=Microcontrollers&w2=Microprocessor&w3=Intel+microprocessors&w4=Pic+microcontrollers&c=4&s=95&.sig=Malspbd0T4Rq3M4Q0nHrfw>
>  ------------------------------
> >.
>
>
>  ------------------------------
>
	--
Felipe Fontoura
Linux user: #281076
	[Non-text portions of this message have been removed]
	


(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: Re: How to protect code in LPC2129 - Rui Gonçalves - Feb 16 12:59:00 2006

Thanks, (again) Karl.

I've done that but when I read the flash buffer
the value in position 0x1FC is 0x21346587
instead of 0x87654321. Do you know why?

What can I do to correct the problem?
Write 
  .word 0x21435687

I'm using GCC 4.0.2
	----- Mensagem Original -----
De: Karl Olsen <kro@kro@...>
Data: Quinta-Feira, 16 de Fevereiro de 2006, 15:20
Assunto: [lpc2000] Re: How to protect code in LPC2129

> --- In lpc2000@lpc2..., "r_goncalves2000" 
> <rpsgoncalves@...> 
> wrote:
> 
> > I'm devoloping a aplication in LPC2129 and I want to protect
> > the code from reading.
> > I read the manual but still have some doubts:
> > 
> > 1. Can I program the LPC2129 and then protect it from code reading
> > by writing the value 0x87654321 in position 0x1FC using Philips
> > LPC2000 Flash Utility? How to do that?
> 
> Address 0x1FC is normally in the middle of your program, and you 
> should not overwrite it from the Flash Utility unless you 
> absolutely 
> know that that location is unused.
> See http://groups.yahoo.com/group/lpc2000/message/11515
> 
> 
> > 2. After protecting the LPC can I erase it and reprogram it?
> 
> Yes.
> 
> Karl Olsen
> 
> 
> 
> 
> 
> 
> 
> Yahoo! Groups Links
> 
> 
> 
> 
> 
> 
> 

_______________________________________________________________________________________
De forma aos seus desejos! Tenha ate 8000 euros para fazer o que quiser. Sem burocracia.
Saber mais em http://www.iol.pt/correio/rodape.php?dst=0510281
	


(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: Re: How to protect code in LPC2129 - Karl Olsen - Feb 16 17:00:00 2006

---- Original Message ----
From: "Rui Gonçalves" <rpsgoncalves@rpsg...>
To: <lpc2000@lpc2...>
Sent: Thursday, February 16, 2006 5:59 PM
Subject: Re: [lpc2000] Re: How to protect code in LPC2129

> I've done that but when I read the flash buffer
> the value in position 0x1FC is 0x21346587
> instead of 0x87654321. Do you know why?
>
> What can I do to correct the problem?
> Write
>  .word 0x21435687

I finally tested http://groups.yahoo.com/group/lpc2000/message/11515 on my
LPC2103, and it works.  The Philips Flash Utility gives the not so useful
error message "Cannot communicate with test board!" when I try a Download
Flash or erase a subset of the sectors.

The LPC2000 uses little endian, so the value should be stored like this:

0x1FC = 0x21
0x1FD = 0x43
0x1FE = 0x65
0x1FF = 0x87

This is not an error.

Karl Olsen
	


(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: Re: How to protect code in LPC2129 - Rui Gonçalves - Feb 17 5:32:00 2006

You are absolutly right Karl.
I've tested and it works just fine.
Thanks, once more.

Another question.
How can I place same assembler code before position
0x01FC? And C code (compiled with gnuarm)?

Rui Gonçalves
	----- Mensagem Original -----
De: Karl Olsen <kro@kro@...>
Data: Quinta-Feira, 16 de Fevereiro de 2006, 21:00
Assunto: Re: [lpc2000] Re: How to protect code in LPC2129

> ---- Original Message ----
> From: "Rui Gonçalves" <rpsgoncalves@rpsg...>
> To: <lpc2000@lpc2...>
> Sent: Thursday, February 16, 2006 5:59 PM
> Subject: Re: [lpc2000] Re: How to protect code in LPC2129
> 
> > I've done that but when I read the flash buffer
> > the value in position 0x1FC is 0x21346587
> > instead of 0x87654321. Do you know why?
> >
> > What can I do to correct the problem?
> > Write
> >  .word 0x21435687
> 
> I finally tested 
> http://groups.yahoo.com/group/lpc2000/message/11515 on my
> LPC2103, and it works.  The Philips Flash Utility gives the not so 
> usefulerror message "Cannot communicate with test board!" when I 
> try a Download
> Flash or erase a subset of the sectors.
> 
> The LPC2000 uses little endian, so the value should be stored like 
> this:
> 0x1FC = 0x21
> 0x1FD = 0x43
> 0x1FE = 0x65
> 0x1FF = 0x87
> 
> This is not an error.
> 
> Karl Olsen
> 
> 
> 
> 
> Yahoo! Groups Links
> 
> 
> 
> 
> 
> 
> 

_______________________________________________________________________________________
Ate 4500 euros para o que desejar!
Saber mais em http://www.iol.pt/correio/rodape.php?dst=0601271
	


(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: How to protect code in LPC2129 - Thiadmer Riemersma ITB CompuPhase - Feb 17 6:13:00 2006

--- In lpc2000@lpc2..., Rui Gonçalves <rpsgoncalves@...> wrote:
> How can I place same assembler code before position
> 0x01FC? And C code (compiled with gnuarm)?

I have the following in the linker definition file for protected code:
    SECTIONS {
    . = 0
    startup : {
        *(.startup)
        . = 0x1fc;
        LONG(0x87654321);
    } >flash
    prog : {
        *(.text)
        *(.rodata)
        *(.rodata*)
        *(.glue_7)
        *(.glue_7t)
    } >flash
etc. etc.

Assembler code in section ".startup" comes before the protection key
(0x87654321). Of course, it is my own responsibility to ensure that
this code takes less than 0x1fc bytes. Code generated by GCC in the
.text, .rodata and other sections come behind the protection key.

Kind regards,
Thiadmer Riemersma
	


(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: Re: How to protect code in LPC2129 - Rui Gonçalves - Feb 17 6:51:00 2006

Hello Thiadmer

Done that in the linker file but I get an error message.

GNUARM/bin/../lib/gcc/arm-elf/4.0.2/../../../../arm-elf/bin/ld: cannot find .=0x1fc
collect2: ld returned 1 exit status

Do you know why?

I have some assembler code that I can put before position
0x1FC but I don't know how to place that code there.
Can you please explain me how to do that?

Thanks.
Rui
	----- Mensagem Original -----
De: Thiadmer Riemersma ITB CompuPhase <go@go@....>
Data: Sexta-Feira, 17 de Fevereiro de 2006, 10:13
Assunto: [lpc2000] Re: How to protect code in LPC2129

> --- In lpc2000@lpc2..., Rui Gonçalves <rpsgoncalves@...> 
> wrote:> How can I place same assembler code before position
> > 0x01FC? And C code (compiled with gnuarm)?
> 
> I have the following in the linker definition file for protected code:
>    SECTIONS {
>    . = 0
>    startup : {
>        *(.startup)
>        . = 0x1fc;
>        LONG(0x87654321);
>    } >flash
>    prog : {
>        *(.text)
>        *(.rodata)
>        *(.rodata*)
>        *(.glue_7)
>        *(.glue_7t)
>    } >flash
> etc. etc.
> 
> Assembler code in section ".startup" comes before the protection key
> (0x87654321). Of course, it is my own responsibility to ensure that
> this code takes less than 0x1fc bytes. Code generated by GCC in the
> .text, .rodata and other sections come behind the protection key.
> 
> Kind regards,
> Thiadmer Riemersma
> 
> 
> 
> 
> 
> 
> Yahoo! Groups Links
> 
> 
> 
> 
> 
> 
> 
> 

_______________________________________________________________________________________
Ate 4500 euros para o que desejar!
Saber mais em http://www.iol.pt/correio/rodape.php?dst=0601271
	


(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: How to protect code in LPC2129 - Thiadmer Riemersma ITB CompuPhase - Feb 17 8:14:00 2006

--- In lpc2000@lpc2..., Rui Gonçalves <rpsgoncalves@...> wrote:
>
> Hello Thiadmer
> 
> Done that in the linker file but I get an error message.
> 
> GNUARM/bin/../lib/gcc/arm-elf/4.0.2/../../../../arm-elf/bin/ld:
cannot find .=0x1fc collect2: ld returned 1 exit status
> 
> Do you know why?

I do not know why, but it appears that the linker interprets the
string ".=0x1fc" as a segment name or object filename. Is there a
semicolon behind 0x1fc?

Kind regards,
Thiadmer Riemersma
	


(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: Re: How to protect code in LPC2129 - Rui Gonçalves - Feb 17 14:45:00 2006

The semicolon is there.
I remove it and the result is the same.

Regards.
Rui
	----- Mensagem Original -----
De: Thiadmer Riemersma ITB CompuPhase <go@go@....>
Data: Sexta-Feira, 17 de Fevereiro de 2006, 12:14
Assunto: [lpc2000] Re: How to protect code in LPC2129

> --- In lpc2000@lpc2..., Rui Gonçalves <rpsgoncalves@...> 
> wrote:>
> > Hello Thiadmer
> > 
> > Done that in the linker file but I get an error message.
> > 
> > GNUARM/bin/../lib/gcc/arm-elf/4.0.2/../../../../arm-elf/bin/ld:
> cannot find .=0x1fc collect2: ld returned 1 exit status
> > 
> > Do you know why?
> 
> I do not know why, but it appears that the linker interprets the
> string ".=0x1fc" as a segment name or object filename. Is there a
> semicolon behind 0x1fc?
> 
> Kind regards,
> Thiadmer Riemersma
> 
> 
> 
> 
> 
> 
> Yahoo! Groups Links
> 
> 
> 
> 
> 
> 
> 
> 

_______________________________________________________________________________________
Ate 4500 euros para o que desejar!
Saber mais em http://www.iol.pt/correio/rodape.php?dst=0601271
	


(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: How to protect code in LPC2129 - Jayasooriah - Feb 19 19:47:00 2006

Hi Rui,

You can use the following assembler code if you are using GAS.  Including 
the stub below in your startup code.

As part of building procedure, I check and panic if the symbol "crpWord" 
resolves to something other than 0x1fc -- this can happen when code is 
moved around.

Hope this helps.

Jaya

PS: (Caveat) I refute claims that enabling CRP protects on-chip flash contents.

>         @ enable/disable CRP
>     .set    CRP_WORD,       1
>
>        [ other manifests here ]
>
>         .section .init
>
>   [ startup code here ]
>
>.if     CRP_WORD
>         .code   32
>
>         @ CRP location
>         . = 0x1fc
>
>         .global crpWord
>crpWord:
>         @ CRP contents
>         strhib  r4, [r5, -r1, lsr #6]!
>
>.endif
	--- In lpc2000@lpc2..., Rui Gonçalves <rpsgoncalves@...> wrote:
 >
 > You are absolutly right Karl.
 > I've tested and it works just fine.
 > Thanks, once more.
 >
 > Another question.
 > How can I place same assembler code before position
 > 0x01FC? And C code (compiled with gnuarm)?
 >
 > Rui Gonçalves

Send instant messages to your online friends http://au.messenger.yahoo.com 



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )