How to protect code in LPC2129
2006-02-16 by r_goncalves2000
Yahoo Groups archive
Index last updated: 2026-04-28 23:31 UTC
Thread
2006-02-16 by r_goncalves2000
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
2006-02-16 by Karl Olsen
--- In lpc2000@yahoogroups.com, "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
2006-02-16 by Felipe Fontoura
Hi, I need the some information for LPC2138 <- Tks to all 2006/2/16, Karl Olsen <kro@...>: > > --- In lpc2000@yahoogroups.com, "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> > ------------------------------ > YAHOO! GROUPS LINKS > > > - Visit your group "lpc2000 <http://groups.yahoo.com/group/lpc2000>" > on the web. > > - To unsubscribe from this group, send an email to: > lpc2000-unsubscribe@yahoogroups.com<lpc2000-unsubscribe@yahoogroups.com?subject=Unsubscribe> > > - Your use of Yahoo! Groups is subject to the Yahoo! Terms of > Service <http://docs.yahoo.com/info/terms/>. > > > ------------------------------ > -- Felipe Fontoura Linux user: #281076 [Non-text portions of this message have been removed]
2006-02-16 by Rui Gonçalves
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@...> Data: Quinta-Feira, 16 de Fevereiro de 2006, 15:20 Assunto: [lpc2000] Re: How to protect code in LPC2129 > --- In lpc2000@yahoogroups.com, "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
2006-02-16 by Karl Olsen
---- Original Message ----
From: "Rui Gon\ufffdalves" <rpsgoncalves@...> To: <lpc2000@yahoogroups.com> 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
2006-02-17 by Rui Gonçalves
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@...> 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@...> > To: <lpc2000@yahoogroups.com> > 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
2006-02-17 by Thiadmer Riemersma (ITB CompuPhase)
--- In lpc2000@yahoogroups.com, 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 Riemersma2006-02-17 by Rui Gonçalves
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@...>
Data: Sexta-Feira, 17 de Fevereiro de 2006, 10:13
Assunto: [lpc2000] Re: How to protect code in LPC2129
> --- In lpc2000@yahoogroups.com, 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=06012712006-02-17 by Thiadmer Riemersma (ITB CompuPhase)
--- In lpc2000@yahoogroups.com, 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
2006-02-17 by Rui Gonçalves
The semicolon is there. I remove it and the result is the same. Regards. Rui ----- Mensagem Original ----- De: Thiadmer Riemersma ITB CompuPhase <go@...> Data: Sexta-Feira, 17 de Fevereiro de 2006, 12:14 Assunto: [lpc2000] Re: How to protect code in LPC2129 > --- In lpc2000@yahoogroups.com, 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
2006-02-19 by Jayasooriah
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@yahoogroups.com, 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