This code is an addon patch on 2440test project. 2440test is a C based project provide my FriendlyARM DVD. ARM Developer Studio is needed to compile and build this project and binary can be loaded to Mini2440 via JTAG. This change is needed in main.c. We are enabling and setting CLK0 pin clock pin and connecting this to PCLK. We are also setting GPIOA 13 pin as Address chip select pin for the address 0x10000000. Next is basically a loop where we are waiting for 1s and toggling LED status. We are first reading the status in a byte. Then toggling LSB bit. Then again writing the state back to device.
This is the disassembly of the C code
val = *((unsigned char*)0x10000000); val ^= 1; *(char*)0x10000000 = val; [0xe3a00540] * mov r0,#0x10000000 [0xe5d06000] ldrb r6,[r0,#0] [0xe2266001] eor r6,r6,#1 [0xe3a00540] mov r0,#0x10000000 [0xe5c06000] strb r6,[r0,#0]
Output: LED will turn on or off as per val 0 bit. Interrupt will be triggred