AnsweredAssumed Answered

GCC/CodeSourcery toolchain on windows/linux ?

Question asked by a. richard on Oct 9, 2010
Latest reply on Oct 19, 2010 by Clive One
has anyone succeeded in configuring a foss toolchain for stm32f100 (discovery board chip)?

I have installed the latest codesourcery, and tried this example (compile lib, compile main code) but it's rather old and uses fwlib v1.0. Which I wouldn't mind, but after compiling it, I flash it to the board using the stlink utility, and it doesn't start. I've started hacking through it, changing output pins, enabling more peripherals, just to get something working, alas, nothing.

Then i've resorted to trying something simpler, while keeping the original linkerscript and lib in effect. This code was found on I used this for main.
  int button; 
  int n; 
    RCC->APB2ENR |= 0x10 | 0x04;                                    /* Enable the GPIOA (bit 2) and GPIOC (bit 8) */ 
    GPIOC->CRH = 0x11;                                                /* Set GPIOC Pin 8 and Pin 9 to outputs */ 
    GPIOA->CRL = 0x04;                                                /* Set GPIOA Pin 0 to input floating */ 

    while(1)     {         delay();                                                    /* A short delay */         button = ((GPIOA->IDR & 0x1) == 0);                            /* Read the button - the button pulls down PA0 to logic 0 */         n++;                                                        /* Count the delays */         if (n & 1) {                                                /* Copy bit 0 of counter into GPIOC:Pin 8 */             GPIOC->BSRR = 1<<8 ;          } else {              GPIOC->BSRR = 1<<24;             }         if ((n & 4) && button) {                                    /* Copy bit 4 of counter into GPIOC:Pin 9 if button pressed */             GPIOC->BSRR = 1<<9 ;          } else {              GPIOC->BSRR = 1<<25;             }     }
All nice and simple, direct register access, should work, right? Nope, it still doesn't work. I flash it, reset the core, then run the code, and nothing happens.

So I've decided to try the whole blinky deal, located here, which compiled right, and works after flashing. I was able to make changes to the files, and see the results on the board, and most importantly, I wasn't forced to use those horrible IDEs by attolic/keil/whatever.

But I can't use the fwlib and for now I really don't feel like writing my own libraries to set IO direction/speed/etc (although the default ones seem rather cpu hungry).

Does anyone have a working, demo project (flash a led, read the button, etc) that succesfully uses fwlib and works with a free toolchain?