Hi,
I have created a new project in CCSv6 - Version: 6.0.0.00156.
When I try to use the rand(); function the MSP430f5438a reboots when the line __TI_resource_lock(__TI_LOCK_RAND); is executed. This is because the address it's trying to jump to in the disassembly is 0x00000.
Is there something I have missed when setting up my project that creates this error?
I actually have another project where rand() works fine, and can't figure out whats different in it.
Thanks.
-Fredrik
From rand.c v4.3.1:
_CODE_ACCESS int rand(void) { int r; /*---------------------------------------------------------------------*/ /* To maintain backwards compatibility with releases that do not use */ /* TLS, we use a mutex lock to protect accesses to the variable 'next'.*/ /*---------------------------------------------------------------------*/ #if !defined(__TI_USE_TLS) __TI_resource_lock(__TI_LOCK_RAND); <---- Here #endif
From disassembly(when I mouse over &_lock it shows _lock = 0x000000:
0117b0: 8321 DECD.W SP 62 __TI_resource_lock(__TI_LOCK_RAND); 0117b2: 1380 2000 CALLA &_lock 64 next = next * 1103515245 + 12345;