...enable code read protection (LPC2000)



  • Avatar
    Jerry Sweet

    I can't get this to work.  When I write ANY value to address 0x1fc, my app doesn't work properly, like so:

    ldr pc, [pc, #reset_handler_address - . - 8] /* reset */
    ldr pc, [pc, #undef_handler_address - . - 8] /* undefined instruction */
    ldr pc, [pc, #swi_handler_address - . - 8] /* swi handler */
    ldr pc, [pc, #pabort_handler_address - . - 8] /* abort prefetch */
    ldr pc, [pc, #dabort_handler_address - . - 8] /* abort data */
    .word 0xB9206E58 /* boot loader checksum */
    ldr pc, [pc, #-0x120] /* irq handler */
    .word 0xB8A06F60 /* boot loader checksum */
    ldr pc, [pc, #irq_handler_address - . - 8] /* irq handler */
    ldr pc, [pc, #fiq_handler_address - . - 8] /* fiq handler */
    .org 0x000001fc
    .word 0xa5a5a5a5

    I can see via the debugger that address 0x1fc does contain the value I gave it, but this causes my app to crash for some reason.  I am guessing this is because I overwrote some code that was there?  How do I reserve address 0x1fc?  Do I need to do this in a linker file?  If I remove those last two lines above, everything is hunky dory except that I need code protection.


    Comment actions Permalink
  • Avatar
    Jon Elliott


    It looks like you've put the code midway through the vectors section, put the code at the end of the .vectors section, i.e. just before the .section .init, "ax" statement in most LPC2000 startup code.



    Comment actions Permalink

Please sign in to leave a comment.