cancel
Showing results for 
Search instead for 
Did you mean: 

So no-one has a clue on this one.

broadcast
Associate II
Posted on February 14, 2007 at 20:41

So no-one has a clue on this one.

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

What about an example gnuarm command sequence that is known to work.

> 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.

>

[ This message was edited by: heroineworshipper on 08-02-2007 04:27 ]

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

Strange Title,

Could you attached your complete project, as this may help.

Have a look at Anglia IDEaliST, it has a few example using gcc for the str9:

http://www.st-angliamicro.com/software.asp

I would also not recommend the O3 option for gcc, it is not as well tested as the other.

Regards

sjo

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

This was in reference to ''Can someone try this program to make sure it works?'' which no-one responded to. Knowing if the program worked on another chip would eliminate one possibility with the chip not working. With the IDEaliST examples, discovered the SRAM offset was wrong. The IDEaliST package doesn't seem to have any compiler usage examples, only linker scripts.

The attached tarball builds the image if you run make.

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

Hi heroineworshipper;

I tried to compile your project with two different compiler (Ride and Hitop), unfortunately, it seems that there are some missing files.

in fact, the linker shows that the stdint.h, parapin.h file are missing and others. :-Y

Finally, can you precise if you're working on Linux or windows ?(more details on your work space and the debugger you're using :-] )

Waiting for your response.

Best regards,

MBS

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

This project compiles in Linux with gnuarm only. It could probably be built in Windows, but you'd have to point the include path to the current directory and the library directory to find all the includes. The only source which has to be built is bootloader.c and that uses headers from the library directory. jtag.c is only a JTAG programmer for Linux and can be ignored.

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

Hi heroineworshipper;

Good news :p ;

Your program works fine on GNUARM compiler with windows, now it's in your side (run it on Linux).

First, i have done this small correction on your code in order to have a visual result on the Eval board of ST(MB460).in fact, i need to enable the GPIO 9 to turn the led 0 on and it works fine . :-]

More over, i want to notify that i verified the different register values and it seems that they are right!

In other way, keep in mind that i didn't use your linker (i used the raisonance linker, find it attached with the init.s file) you have to modify them to make them work on Linux.

#include ''91x_lib.h''

GPIO_InitTypeDef GPIO_InitStructure;

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;

/*-------------enable GPIO9----------*/

// Enable alternate output 1

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

// Output direction

GPIO9->DDR |= GPIO_Pin_0;

// Disconnect from input

SCU->GPIOIN[9] = 0;

// Pin value

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

GPIO_WriteBit(GPIO9, GPIO_Pin_0, Bit_SET);

GPIO_WriteBit(GPIO9, GPIO_Pin_0, Bit_RESET);/*------ 😉 it works-----------*/

while(1)

;

}

Waiting for your response.

Best regards,

MBS

[ This message was edited by: MBS on 13-02-2007 10:59 ]

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

Thanks for your hard work. I'll replace the part and give it one more try with the final part.