This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Different behaviour with different dev boards

Hey everyone,

I'm getting a really weird error. I'm using two dev boards for my application: a PCA10001 board (MBED enabled) and a PCA20006 beacon board with Segger's j-link debugger.

I program the MBED board by compiling my code with make, merging it with the softdevice, and dragging the resulting hex file to the MBED mass storage device.

I program the beacon board by using the exact same makefile (only changing the board define from -DBOARD_PCA10001 to -DPCA20006), afterwards I run a small flashing script.

BOARD = -DBOARD_PCA20006
#BOARD = -DBOARD_PCA10001

_

CFLAGS += $(BOARD)

_

#commands
echo "loadbin $SoftDevice 0 #flash softdevice" > $tmpScriptName
echo "loadbin $Program 0x16000 #flash program" >> $tmpScriptName
echo "r" >> $tmpScriptName #reset
echo "g" >> $tmpScriptName #go (run)
echo "exit" >> $tmpScriptName

$JLinkExe -device nrf51822 -speed 1000 -if swd $tmpScriptName
rm $tmpScriptName

echo "Finished"

My problem is, I'm getting different behaviours with different boards. In the MBED board my code runs as is expected, in the beacon board I get a hardfault at strtok.

the hardfault trace

Any ideas on why this could be happening?

  • No I have no ideas. However I assume both of them go through strtok() at some point early in the process, how about putting a breakpoint there to find out if the arguments are the same or different.

    What assembler is it actually executing, or just executed, when it goes to hardfault? strtok must be a pretty simple routine, only reads bytes you'd think, so shouldn't be word alignment, I have to think you're reading memory at a very invalid location. Where does the string you are tokenizing come from?

  • probably both has different RAM sizes, did you check if the latter board has program compiled with correct RAM size?

Related