--- In lpc2000@yahoogroups.com, "phlpcmicro" <joseph.goldburg@a...> wrote: > I am looking for code examples on how to set Code Protection on. > > Eg address 0x1FC = 0x87654321 > > For GCC, Keil and IAR > > > Eg Does this look right? > // write to address macro > #define REG(addr) (*(static unsigned long *)(addr)) > > REG(0x1FC) = 0x87654321; > > Or would it be better loaded in the startup file. You cannot do it in that way. The address is in flash which cannot be written like RAM. With GCC, you can do it like this, in startup.s (it compiles, not tested at runtime): Vectors: B Reset_Handler B Undef_Panic B SWI_Panic B PAbort_Panic B DAbort_Panic NOP B IRQ_Panic B FIQ_Panic .org 0x01FC .word 0x87654321 In this way, you waste the 476 bytes between the vectors and the magic word. You can put some other code between the vectors and the .org to waste less. Karl Olsen
Message
Re: LPC2000 Flash protection example wanted
2005-12-19 by Karl Olsen
Attachments
- No local attachments were found for this message.