Skip to main content
rael
Associate III
May 9, 2009
Question

C skeleton for stm32F10xx series?

  • May 9, 2009
  • 16 replies
  • 2903 views
Posted on May 09, 2009 at 03:58

C skeleton for stm32F10xx series?

    This topic has been closed for replies.

    16 replies

    rael
    raelAuthor
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 13:11

    relaxe,

    I did some coding with the Pic 16C and 16F series too.

    I found the conditional jumps non intuitive, but I got by and did quite a few small applications with it.

    Then, I switched to the AVR, and was amazed by it's speed, and found that my code would work bug free for quite large sections, it did what I thought it would first time.

    I know C has some issues that ''Get'' people, I suspect it will take me a bit to figure out the addressing modes and pointer, by val, by address referencing options.

    I've got plenty of easy I/O to fiddle with though, so once I figure out how to map the pheripherals to the correct(/alternate?) pins, I will start with the simple stuff.

    Progress is going on this thread in the reprap forums:

    http://forums.reprap.org/read.php?13,21002,page=2

    I will check in the Library for some books on C over the weekend, not too worried about the ARM cortex itself, as I will be pulling in so much C code from things like SD card demo routines, that I would be setting myself up for a lot more work to try and interface them in assembler.

    I've got an STM circle, but I don't want to try stuff out on that at the moment, as I would be diverting too much time to ''non productive'' testing.

    I have other boards to populate if I inadvertantly ''cook'' something, and I have polyswitch fuses on all my stepper coils.

    LCDs can be fussy about power sequencing... but I can probable even find some existing arm code ? else convert some of my assembler code to C, with huge delays.

    I might use an already developed R.T.O.S., if I can find one I like

    Graham. :)

    rael
    raelAuthor
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 13:11

    A question,

    I'm getting an error: ''expected ')' before '*' token'',

    and the line reads:

    void assert_failed(uint8_t* file, uint32_t line);

    From brouing similiar problems on the web, I get the idea that something is wrong with the uint8_t parameter, but I don't know the resolution.

    Can anybody explain please ?

    Thanks, Graham.

    relaxe
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 13:11

    You should copy paste a longer section of code. This line looks good. Could you have missed a ';' one or two lines up from there?

    rael
    raelAuthor
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 13:11

    It looks like the STM pheripherals library version 3.0 is different than from the Raisonance ones.

    I'll go with the latter for now :-?

    It's still throwing up errors when I enable some of the pheripheral libraries, so I think I WILL start with a demo project, but I will also modify it heavily before sending it to my board.

    (after I figure out how to compile to a .hex file for the RS232 serial boot loader!)

    rael
    raelAuthor
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 13:11

    I'm happier now...

    I have my Piezo, an LED and some darlington transistor outputs toggling.

    Some of my issues were related to my include files being partially sourced from my new directory, but my project tree being inconsistent with where the include files were being referenced from.

    So... I was looking for a port invocation that was set the way I expected and needed to change, but in the wrong directory, where that invocation had actually been made. :|

    Progress will be a lot faster now ! :)

    Thanks for the ideas guys !

    rael
    raelAuthor
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 13:11

    This is the code:

    #ifdef USE_FULL_ASSERT

    /**

    * @brief The assert_param macro is used for function's parameters check.

    * @param expr: If expr is false, it calls assert_failed function

    * which reports the name of the source file and the source

    * line number of the call that failed.

    * If expr is true, it returns no value.

    * @retval : None

    **/

    #define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__))

    /* Exported functions ------------------------------------------------------- */

    void assert_failed(uint8_t* file, uint32_t line);

    #else

    #define assert_param(expr) ((void)0)

    #endif /* USE_FULL_ASSERT */

    #endif /* __STM32F10x_CONF_H */

    It's not even my code !

    The RIDE compiler identifies syntax errors etc by file an line, double clicking takes you to the file, but not directly to the line.

    I think I might be stumbling into a compiler specific issue, the raisonance STMCircle file uses this:

    #ifdef DEBUG

    /*******************************************************************************

    * Function Name : assert_failed

    * Description : Reports the name of the source file and the source line number

    * where the assert error has occurred.

    * Input : - file: pointer to the source file name

    * - line: assert error line source number

    * Output : None

    * Return : None

    *******************************************************************************/

    void assert_failed(u8* file, u32 line)

    {

    /* User can add his own implementation to report the file name and line number,

    ex: printf(''Wrong parameters value: file %s on line %d\r\n'', file, line) */

    /* Infinite loop */

    while (1)

    {

    }

    }

    #endif

    and compiles without errors.

    Any ideas ? :o

    I was hoping to start with the most up to date environment.