c - bpkt ARM instruction freezes my embedded application -


i developing application compile iar embedded workbench solution. in application, have embedded expat library - tiny xml parser works fine - uses time() standard function generate salt, can see in chunk of code:

static unsigned long generate_hash_secret_salt(void) {     unsigned int seed = time(null) % uint_max;     srand(seed);     return rand(); } 

it appears time() function works fine on semihosting mode (while debugging j-link jtag device segger, guess) not work @ when running application without j-link debugger.

so i've run assembly code of time() function - appears proprietary implementation iar - , saw single instruction:

bpkt #0xab 

by seeking information through web, came following paragraph:

if required, debugger can use store additional information breakpoint. arm not recommend use of bkpt instruction immediate value set 0xab purpose other semi-hosting.

is due such issue? must admit knowledge in arm assembler poor, , since cannot debug application while not on semi-hosting mode, pretty confused.

for information, regardless of argument may pass time(), freezing in non semihosting mode.

finally, suggest me in order bypass such implementation? shall import 1 c project? ...

thanks

you're right breakpoint instruction being used trigger kind of semihosting operation. if code contains such instructions, you'll need run attached debugger knows when such instruction encountered. if need run device standalone, find out code you're using causes semihosting operations take place, , make sure code isn't in standalone build. situation opportunity set "debug" , "release" builds of software - maybe using #ifdef debug or along lines exclude semihosting code release build.

in specific case, looks c library's time implementation using semihosting host time on debugger connection. you'll have come different solution if want run program disconnected debugger.


Comments