cancel
Showing results for 
Search instead for 
Did you mean: 

Can someone try this program to make sure it works?

broadcast
Associate II
Posted on February 07, 2007 at 18:22

Can someone try this program to make sure it works?

2 REPLIES 2
broadcast
Associate II
Posted on May 17, 2011 at 09:36

I have been unable to get this very simple program to work on an str9:

#include ''91x_lib.h''

static GPIO_TypeDef *GPIO4 = (GPIO_TypeDef*)GPIO4_BASE;

static SCU_TypeDef *SCU = (SCU_TypeDef*)SCU_BASE;

static FMI_TypeDef *FMI = (FMI_TypeDef*)FMI_BASE;

void main()

{

/* Set the peripheral Clock to MCLK/2 */

/* And main clock to the oscillator */

SCU->CLKCNTR = 0x00020082;

// Disable port reset

SCU->PRR0 |= 0xffffffff;

SCU->PRR1 |= 0xffffffff;

// SCU->PRR1 |= __GPIO4;

// Digital mode

SCU->GPIOANA = 0x00;

SCU->PCGRO = 0xffffffff;

// Enable GPIO port clock

SCU->PCGR1 |= 0xffffffff;

// SCU->PCGR1 |= __GPIO4;

// Enable alternate output 1

SCU->GPIOOUT[4] = 0x1 << 8;

// Push/Pull mode

SCU->GPIOTYPE[4] = 0x0;

// Output direction

GPIO4->DDR |= GPIO_Pin_0;

// Disconnect from input

SCU->GPIOIN[4] = 0;

// Pin value

GPIO4->DR[GPIO_Pin_0 << 2] = 1;

while(1)

;

}

The idea is just to set GPIO4 pin 0 to prove it's running. The compilation sequence is:

/opt/gnuarm/bin/arm-elf-gcc -O3 -c -I. -Ilibrary -mcpu=arm9 -nostartfiles bootloader.c -o bootloader.o

/opt/gnuarm/bin/arm-elf-gcc -mcpu=arm9 -nostartfiles -Tlinker.ld -o bootloader.elf bootloader.o

/opt/gnuarm/bin/arm-elf-objcopy bootloader.elf -O binary bootloader.bin

The symbol offsets are:

0000000000000000 t $a

0000000040000008 B __bss_beg__

0000000040000008 A __bss_end__

0000000040000008 A _bss_end__

0000000040000000 d $d

0000000000000068 t $d

0000000040000000 D __data_beg__

0000000000000074 A __data_beg_src__

0000000040000008 D __data_end__

0000000040000008 A _end

0000000040000008 A __end__

0000000000000074 A __end_of_text__

0000000040000000 d GPIO4

0000000000000000 T main

0000000040000004 d SCU

000000004000fffc A __stack_end__

JTAG shows the flash is programmed correctly. It neither works from primary or secondary flash. The reset pin is high. Only one set of VDDQ, VSSQ, VSS, VDD pins is connected because a continuity test says they're all common. VBatt is disconnected.

GPIO4:0 is never affected during execution.

broadcast
Associate II
Posted on May 17, 2011 at 09:36

No-one has a clue on this one. How about an example gnuarm command sequence that is known to work.