diff options
author | Pavel Pisa <pisa@cmp.felk.cvut.cz> | 2015-11-28 12:01:36 +0100 |
---|---|---|
committer | Gedare Bloom <gedare@rtems.org> | 2015-12-01 21:09:41 -0500 |
commit | 4a02a74154f40850d4a8fd99b6d25c23ee9bb46a (patch) | |
tree | fe1e51a371950d9967314850ed8263cd68e8e115 /c/src/lib/libbsp/arm | |
parent | psxtmtests_plan.csv: Fix typo (diff) | |
download | rtems-4a02a74154f40850d4a8fd99b6d25c23ee9bb46a.tar.bz2 |
bsp/tms570: ensure that linker symbol comparison to NULL is not optimized out.
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Diffstat (limited to 'c/src/lib/libbsp/arm')
-rw-r--r-- | c/src/lib/libbsp/arm/tms570/startup/bspstart.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/c/src/lib/libbsp/arm/tms570/startup/bspstart.c b/c/src/lib/libbsp/arm/tms570/startup/bspstart.c index b7e2b62591..7c1e9a17bf 100644 --- a/c/src/lib/libbsp/arm/tms570/startup/bspstart.c +++ b/c/src/lib/libbsp/arm/tms570/startup/bspstart.c @@ -32,6 +32,9 @@ void bsp_start( void ) { + void *need_remap_ptr; + unsigned int need_remap_int; + #if BYTE_ORDER == BIG_ENDIAN /* * If CPU is big endian (TMS570 family variant) @@ -65,9 +68,16 @@ void bsp_start( void ) * SRAM then it leads to CPU error halt. * * So use of POM to replace jumps to vectors target - * addresses seems to be the best option. + * addresses seems to be the best option for now. + * + * The passing of linker symbol (represented as start address + * of global array) through dummy asm block ensures that C compiler + * cannot optimize comparison out on premise that reference cannot + * evaluate to NULL definition in standard. */ - if ( (uintptr_t)bsp_start_vector_table_begin != 0 ) { + need_remap_ptr = bsp_start_vector_table_begin; + asm volatile ("\n": "=r" (need_remap_int): "0" (need_remap_ptr)); + if ( need_remap_int != 0 ) { tms570_pom_remap(); } |