cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 C/C++ build environment using CodeSourcery Sourcery G++

lanchon
Associate III
Posted on November 25, 2009 at 04:13

STM32 C/C++ build environment using CodeSourcery Sourcery G++

#fyi
26 REPLIES 26
ram2
Associate II
Posted on May 17, 2011 at 12:25

Great work lanchon, I wonder if you have any update since then.

I have tried compiling using the whole pack of ST-Arm_Toolchain_2.1 and it works fine except a few glitches(some minor, some major) and code size difference.

This will be a great thing for my next Xduino (www.xduino.com) project to include a full IDE along with it so developer can use opensource IDE, compiler as well as opensource platform for simple programming.

Did you find any bug in the compiler? I find some output differences from Keil and IAR (some how my serial port mysteriously starts with 7-bit mode instead of 8-bit and maybe other things I cannot fully confirm).

Great work... :D and thank you.

rockydt18
Associate II
Posted on May 17, 2011 at 12:25

Hey!

First of all: lanchon great work! your linker scripts helped me a lot to get things working. But i have one little problem.

I can debug in RAM or Flash and my application is working like it should(tested it with IAR workbench) but i can't get any interrupt. Why..?

I used your stm32exceptions.c and .h file and put my code in it, but it still doesn't trigger any interrupt.

Maybe your or someone has an advice for me...

with kind regards

--

rocky

vaclav
Associate II
Posted on May 17, 2011 at 12:25

Hello all,

I downloaded arm-none-eabi-gcc (Sourcery G++ Lite 2009q1-161) 4.3.3 and tried the sample application from Lanchon's RC2 zip file in this thread - only LED is moved to RB1. But it does not work.

I even tried simple LED blink application (listing is below).

I am downloading the app by stm32 flash loader - so the chip works. I can read the data back. Does anybody have a clue what am I doing wrong ?

1.elf: file format elf32-littlearm

Disassembly of section .text:

00000000 :

0: 00 08 00 20 21 00 00 00 b5 00 00 00 bd 00 00 00 ... !...........

...

00000020 :

/* } */

volatile unsigned int icnt;

int main ( void )

{

20: b480 push {r7}

22: b083 sub sp, #12

24: af00 add r7, sp, #0

unsigned char lpos = 0;

26: f04f 0300 mov.w r3, #0 ; 0x0

2a: 71fb strb r3, [r7, #7]

GPIOB_CRL = 0x44444111;

2c: f640 4200 movw r2, #3072 ; 0xc00

30: f2c4 0201 movt r2, #16385 ; 0x4001

34: f244 1311 movw r3, #16657 ; 0x4111

38: f2c4 4344 movt r3, #17476 ; 0x4444

3c: 6013 str r3, [r2, #0]

GPIOB_ODR = 0x00000005;

3e: f640 430c movw r3, #3084 ; 0xc0c

42: f2c4 0301 movt r3, #16385 ; 0x4001

46: f04f 0205 mov.w r2, #5 ; 0x5

4a: 601a str r2, [r3, #0]

while( 1) {

for(icnt = 0; icnt < 65000; icnt++) ;

4c: f240 0300 movw r3, #0 ; 0x0

50: f2c2 0300 movt r3, #8192 ; 0x2000

54: f04f 0200 mov.w r2, #0 ; 0x0

58: 601a str r2, [r3, #0]

5a: e00b b.n 74

5c: f240 0300 movw r3, #0 ; 0x0

60: f2c2 0300 movt r3, #8192 ; 0x2000

64: 681b ldr r3, [r3, #0]

66: f103 0201 add.w r2, r3, #1 ; 0x1

6a: f240 0300 movw r3, #0 ; 0x0

6e: f2c2 0300 movt r3, #8192 ; 0x2000

72: 601a str r2, [r3, #0]

74: f240 0300 movw r3, #0 ; 0x0

78: f2c2 0300 movt r3, #8192 ; 0x2000

7c: 681a ldr r2, [r3, #0]

7e: f64f 53e7 movw r3, #64999 ; 0xfde7

82: 429a cmp r2, r3

84: d9ea bls.n 5c

lpos++;

86: 79fb ldrb r3, [r7, #7]

88: f103 0301 add.w r3, r3, #1 ; 0x1

8c: 71fb strb r3, [r7, #7]

lpos &= 0x07;

8e: 79fb ldrb r3, [r7, #7]

90: f003 0307 and.w r3, r3, #7 ; 0x7

94: 71fb strb r3, [r7, #7]

GPIOB_BRR = 0x0007;

96: f640 4314 movw r3, #3092 ; 0xc14

9a: f2c4 0301 movt r3, #16385 ; 0x4001

9e: f04f 0207 mov.w r2, #7 ; 0x7

a2: 601a str r2, [r3, #0]

GPIOB_BSRR = lpos;

a4: f640 4310 movw r3, #3088 ; 0xc10

a8: f2c4 0301 movt r3, #16385 ; 0x4001

ac: 79fa ldrb r2, [r7, #7]

ae: 601a str r2, [r3, #0]

b0: e7cc b.n 4c

b2: bf00 nop

000000b4 :

/* return 0; */

/* } */

void isr_nmi( void)

{

b4: b480 push {r7}

b6: af00 add r7, sp, #0

b8: e7fe b.n b8

ba: bf00 nop

000000bc :

while(1);

}

void isr_hardfault( void)

{

bc: b480 push {r7}

be: af00 add r7, sp, #0

c0: e7fe b.n c0

c2: bf00 nop

[ This message was edited by: vaclav.peroutka on 25-11-2009 08:46 ]

ram2
Associate II
Posted on May 17, 2011 at 12:25

Interrupt is a tricky one. Try the xduino library it has sources on simple implementation of interrupt along with examples on the site. : -) good luck...

stm2399
Associate II
Posted on August 28, 2011 at 21:27

The attachments are lost

Would it be possible to reattach them

TIA

Bingo

tsx512
Associate
Posted on April 01, 2015 at 18:59

Hi andreas1,

I saw in your postingm, that you have wrote a GDB STUB for the STM32. I am very interested in details, may the source code.

I am looking for a long time for solution to have GDB connected to the target microcontroller without using JTAG or SWD.

Would be happy to get an answer.

Tom

Posted on April 01, 2015 at 20:45

Understand that these posts are in fact from 2008, after at least two forum meltdowns, and rebuilds. And it's highly unlikely that these participants are monitoring the forum currently.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..