This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Re: Patch for packages\hal\arm\arch\current\src\vectors.S
- From: Gary Thomas <gary at mlbassoc dot com>
- To: wang cui <iucgnaw at msn dot com>
- Cc: ecos-discuss at ecos dot sourceware dot org
- Date: Fri, 25 Aug 2006 06:03:24 -0600
- Subject: Re: [ECOS] Patch for packages\hal\arm\arch\current\src\vectors.S
- References: <BAY110-F2F578D0B25BAF8381D96AA5450@phx.gbl>
wang cui wrote:
> According to LPC2XXX datasheet, checksum of all 8 vectors value must be
> zero, which means Reserved Vector value must be the inversed value of
> sum of other 7 vectors value, so we must compute it before compile and
> place the hardnumber in it.
>
> Actually, when download hex file to LPC2XXX board through ISP, if the
> Reserved Vector is not valid, the ISP program changes this vector to a
> checksum number automatically, and cause error when verify the flash.
> So I modified the vectors.s to resolve it.
>
> ***current code***
> .global __exception_handlers
> __exception_handlers:
> #ifdef CYGSEM_HAL_ROM_RESET_USES_JUMP
> // Assumption: ROM code has these vectors at the hardware reset address.
> // A simple jump removes any address-space dependencies [i.e. safer]
> b reset_vector // 0x00
> #else ldr pc,.reset_vector // 0x00
> #endif ldr pc,.undefined_instruction // 0x04
> ldr pc,.software_interrupt // 0x08 start && software
> int
> ldr pc,.abort_prefetch // 0x0C
> ldr pc,.abort_data // 0x10
> .word 0 // unused
> ldr pc,.IRQ // 0x18
> ldr pc,.FIQ // 0x1C
>
> ***modified code***
> .global __exception_handlers
> __exception_handlers:
> #ifdef CYGSEM_HAL_ROM_RESET_USES_JUMP
> // Assumption: ROM code has these vectors at the hardware reset address.
> // A simple jump removes any address-space dependencies [i.e. safer]
> b reset_vector // 0x00
> #else ldr pc,.reset_vector // 0x00
> #endif ldr pc,.undefined_instruction // 0x04
> ldr pc,.software_interrupt // 0x08 start && software
> int
> ldr pc,.abort_prefetch // 0x0C
> ldr pc,.abort_data // 0x10
> #ifdef CYGPKG_HAL_ARM_LPC2XXX
> #ifdef CYGSEM_HAL_ROM_RESET_USES_JUMP
> .word 0xB4405F62 // checksum of other vectors
> #else .word 0xB8A06F58 // checksum
> of other vectors
> #endif #else
> .word 0 // unused
> #endif
> ldr pc,.IRQ // 0x18
> ldr pc,.FIQ // 0x1C
>
> Should it be patched ?
If you need this value in there to make it work, then yes, there
should be a patch. However, we can't have "#ifdef CYGPKG_HAL_ARM_LPC2XXX"
in there as "vectors.S" should be target independent, i.e. no #if statements
that depend on platform or family - that's just the eCos philosophy.
I'd do it something like this:
#ifdef CYGINT_HAL_ARM_VECTOR_0x14
.word CYGINT_HAL_ARM_VECTOR_0x14
#else
.word 0
#endif
Then, define CYGINT_HAL_ARM_VECTOR_0x14 in the target/platform specific files
for the LPC2XXX.
The other problem I see is that this may not be constant as you have made it.
Would it not change if the various other vector handlers move around, i.e.
if 'abort_data' changes address, etc? Would it not need to be [re]calculated?
--
------------------------------------------------------------
Gary Thomas | Consulting for the
MLB Associates | Embedded world
------------------------------------------------------------
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss