URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Subversion Repositories openrisc
Compare Revisions
- This comparison shows the changes necessary to convert path
/openrisc/trunk/orpsocv2/sw
- from Rev 470 to Rev 475
- ↔ Reverse comparison
Rev 470 → Rev 475
/tests/or1200/sim/or1200-cbasic.c
1,4 → 1,4
/* Test basic c functionality. */ |
/* Test basic c functionality, and BSS section clearing. */ |
#include "cpu-utils.h" |
#include "lib-utils.h" |
|
157,12 → 157,84
return i; |
} |
|
|
/* Test of BSS section being cleared at initialisation. */ |
/* BSS testing requires correct linker symbols in script*/ |
|
static char testchar = 0; |
static short testshort = 0; |
static int testint = 0; |
static long long int testlonglong = 0; |
|
#define BSS_BEGINNING _bss_start |
#define BSS_END _bss_end |
|
/* Variables that will be determined by linker script */ |
extern unsigned int BSS_BEGINNING; |
extern unsigned int BSS_END; |
|
void |
test_bss(void) |
{ |
unsigned long * bss_start_pointer; |
unsigned long * bss_end_pointer; |
|
char * test_char_ptr; |
short * test_short_ptr; |
int * test_int_ptr; |
long long int * test_long_ptr; |
|
bss_start_pointer = (unsigned long*) &BSS_BEGINNING; |
bss_end_pointer = (unsigned long*) &BSS_END; |
|
report ((unsigned long) bss_start_pointer); |
report ((unsigned long) bss_end_pointer); |
|
test_char_ptr = (char*) &testchar; |
test_short_ptr = (short*) &testshort; |
test_int_ptr = (int*) &testint; |
test_long_ptr = (long long int*) &testlonglong; |
|
report ((unsigned long) test_char_ptr); |
report ((unsigned long)testchar & 0xff); |
if (testchar & 0xff) |
exit(1); |
|
report ((unsigned long) test_short_ptr); |
report ((unsigned long) testshort & 0xffff); |
if (testshort & 0xffff) |
exit(2); |
|
report ((unsigned long) test_int_ptr); |
report ((unsigned long) testint); |
if (testint) |
exit(3); |
|
report ((unsigned long) test_long_ptr); |
report ((unsigned long) testlonglong & 0xffffffff); |
report ((unsigned long) (testlonglong >> 32) & 0xffffffff); |
if (testlonglong & 0xffffffff) |
exit(4); |
if ((testlonglong >> 32) & 0xffffffff) |
exit(5); |
|
/* This should be junk (maybe Xs in RTL sim) */ |
int uninited_int; |
report ((unsigned long) &uninited_int); |
report ((unsigned long) uninited_int); |
|
return; |
} |
|
int main() |
{ |
signed long result1 = 0; |
signed long result2 = 0; |
signed long result3 = 0; |
unsigned long final_result; |
|
test_bss(); |
|
result1 = test_cond(1); |
result2 = test_cond(-1); |
result3 -= result1 + result2; |
191,12 → 263,18
result1 = test_array(1); |
result2 = test_array(-1); |
result3 -= result1 + result2; |
report(result2); |
report(result2); |
|
// gives us 8000000d (goooood) |
report(result3+0x3474E142); |
if (result3+0x3474E142 == 0x8000000d) |
exit(0); |
// Check final result |
final_result = (unsigned long)result3; |
|
// Should give us 0x8000000d (Gooooood) |
final_result += 0x3474E142; |
|
report(final_result); |
|
if (final_result == 0x8000000d) |
return 0; |
else |
exit(1); |
return 1; |
} |
/drivers/or1200/crt0.S
296,8 → 296,8
l.and r1, r1, r2 |
*/ |
/* Clear BSS */ |
LOAD_SYMBOL_2_GPR(r28, ___bss_start) |
LOAD_SYMBOL_2_GPR(r30, __end) |
LOAD_SYMBOL_2_GPR(r28, _bss_start) |
LOAD_SYMBOL_2_GPR(r30, _bss_end) |
1: |
l.sw (0)(r28), r0 |
l.sfltu r28, r30 |
/drivers/or1200/link.ld
61,19 → 61,12
_edata = .; |
} > ram |
|
.bss SIZEOF(.data) + ADDR(.data) : |
.bss : |
{ |
sbss = . ; |
_sbss = . ; |
__bss_start = ALIGN(0x8); |
___bss_start = ALIGN(0x8); |
_bss_start = .; |
*(.bss) |
*(COMMON) |
end = ALIGN(0x8); |
_end = ALIGN(0x8); |
__end = ALIGN(0x8); |
ebss = .; |
_ebss = .; |
_bss_end = .; |
} > ram |
|
/* ensure there is enough room for stack */ |