The company I work sells a product designed around a StrongARM SA-1110 processor. The board and all software for this product were designed in-house. Now that Intel has discontinued the StrongARM we're redesigning the board to use a PXA255. I did the original firmware on the old product and now I'm assigned me to port the firmware to the new board.
As a first step I wrote a simple program that runs completely from flash (no RAM used at all) that should toggle GPIO pin 66. I expected to see a nice square wave on the oscilliscope. Well as you might guess I wouldn't be posting this message if I had seen the square wave. Instead of a square wave the osciliscope shows a pattern like
_ _ | | | | ________| |__________| |___________
I've placed the actual ARM assembly code program at the end of this message. In pseudo-code the program is
vectors: @ This is linked to load into loc 0x00000000 b reset_handler reset_handler: initialize the CPU call the delay subroutine initialize the I/O pins main_loop: Set the pin high call the delay subroutine Set the pin low call the delay subroutine branch to main_loop
delay: delay ~200 usec return to caller
What's got me puzzled is that when I add/subtract NOPs or change the location of subroutines it can make the program stop or start working. I modified the program slightly, swaping the locations of the delay subroutine and the main loop, and now I see something like
__________ __________ | | | | __________| |__________| |___________
The pseudo-code for the this program is
vectors: @ This is linked to load into loc 0x00000000 b reset_handler delay: delay ~200 usec return to caller
reset_handler: initialize the CPU call the delay subroutine initialize the I/O pins main_loop: Set the pin high call the delay subroutine Set the pin low call the delay subroutine branch to main_loop
To me the two programs look like they should do exactly the same thing. The only difference between the two is the location of the delay subroutine. I've attached the actual source code to the both of the programs below. I'm using the gas assembler.
Is there anything obvious I'm missing in the initialization? (The initialization code is largely, but not completely taken from eCos.) Or is there a possible hardware problem that could cause this? Our Intel rep says it's not a hardware issue but hasn't come up with any hints about what's wrong with the software.