cancel
Showing results for 
Search instead for 
Did you mean: 

Best Free IDE for programming STM32F769I-DISCO with cubeMX generated firmware?

dheerajdake9
Associate III
Posted on December 15, 2016 at 08:28

Hello everyone,

I have the STM32F769I-DISCO board with LCD on it. The CubeMX has options to generate firmware for the following toolchains:

1. EWARM

[requires a paid license]

2. MDK

[works without license but the IDE is lagging on my computer], P.S- I have a gaming machine with beastly performance.

3. Truestudio

[free, the best IDE so far for me. I am able to write code and launch through this IDE]

4. SW4STM32

[This is the worst toolchain. Inspite of being supported by the STM community, it has several bugs. I was unable to compile the firmware generated by cubeMX. It throws lots of errors.]

For some reasons, the printf is not working in Truestudio. That's why I am looking at the most preferred environment for programming this board.

Sorry to say this, but the firmware examples are very bad. Please include examples which will ease our development.

Thanks

Dheeraj

Note: this post was migrated and contained many threaded conversations, some content may be missing.
23 REPLIES 23
gvigelet
Associate II
Posted on January 20, 2017 at 14:15

Hi 

Dheeraj,

I have very little experience with EWARM and MDK may produce the best binaries but the ide lacks and is pretty dated.  I have used MDK on many projects and over the last couple years have been using Truestudio which is by far my favorite due to the fact many of my other tools are within an eclipse environment and is very familiar as well as supporting many pluggable features.  I myself have had a bunch of issues with the 

SW4STM32 community ide, but that was when it was still new a couple years back so hopefully by now it has matured a little.  

As for the printf not working, hopefully you figured it out by now but if not, I can help you out a little.  Printf works fine with all toolchains, but all tool chains need to be implement the redirection.  A syscalls.c file must be included and the _write function must be implemented to direct the output of printf to where you want it to go.  The following should help and if you do not want the output on the ITM port write to your configured UART with HAL_UART_Transmit function rather than 

ITM_SendChar.

http://blog.atollic.com/cortex-m-debugging-printf-redirection-to-a-debugger-console-using-swv/itm-part-1

 

I have used the following code for years in many different environments from my main.c

#ifdef __GNUC__

/* With GCC/RAISONANCE, small printf (option LD Linker->Libraries->Small printf

      set to 'Yes') calls __io_putchar() */

   #define PUTCHAR_PROTOTYPE int __io_putchar(int ch)

#else

   #define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)

#endif /* __GNUC__ */

/**

* @desc printf I/O implementation

* @param string $msg - the message to be displayed

* @return none

*/

PUTCHAR_PROTOTYPE

{

   /* replace hUart with your uart handle */

   HAL_UART_Transmit(&hUart, (uint8_t *)&ch, 1, 0x0f);

   return ch;

}
Posted on January 21, 2017 at 04:43

Hello, 

I have installed the software from the links you mentioned. Installation was successful. My OpenOCD version is same as yours 1.12.0.201611241417. I tried Debug after the update but I was getting the same errors again. 

0690X000006066iQAA.png

Thank you

Dheeraj

Posted on January 21, 2017 at 04:45

Hello,

The code you pasted for printf() worked in Keil IDE. This is how I got the printf to work previously. It doesn't work in Truestudio. Truestudio is my favourite too. But now I am getting the errors I mentioned in Truestudio too. I wonder why my board is being detected as a USB storage device. The COM port shows up fine though. 

Posted on January 21, 2017 at 07:10

I apologize I did not test it in Truestudio, but I have used it with the GCC chain, you will need to add the tiny_printf.c to your project and then change the prototype for gcc/atollic in main

https://www.dropbox.com/s/vxuqkiydeyvegrq/Screenshot%202017-01-21%2001.01.48.png?dl=0

 

♯ include 'stdio.h'

♯ ifdef __GNUC__

   /* With GCC/ATOLLIC, tiny printf (project explorer new other->Library functions->Tiny printf implementation */

    ♯ define PUTCHAR_PROTOTYPE int _write(int fd, char *str, int len)

♯ else

    ♯ define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)

♯ endif /* __GNUC__ */

/**

* @desc printf I/O implementation

* @param string $msg - the message to be displayed

* @return none

*/

PUTCHAR_PROTOTYPE

{

   /* replace

huart2

with your uart handle */

   HAL_UART_Transmit(&huart2, (uint8_t *)str, len, 0x0f);

   return len;

}

- George

Posted on January 27, 2017 at 16:54

Hello Dheeraj,

Your USB error shows openocd failure.

Could you check under your device manager if the debug dongle is well enumerated as an universal serial bus ?

Like in that picture

0690X00000605ZbQAI.png

Then by expanding STMicroelectronics STLink dongle, could you check if you have same as mine:

0690X00000606AVQAY.png

The next thing you can do is to upgrade your eclipse drivers to 1.13.

Kind regards

Sirma

Posted on January 29, 2017 at 21:44

Here's what I have:

Different from yours

I0690X00000606AuQAI.png

Posted on January 31, 2017 at 11:26

The next you can try is to upgrade the USB dongle firmware.

You should have, under Start->All Programs-> STMicroelectronics-> STM32 ST-LINK Utility, a program called STM32 ST-LINK Utility.exe.

Could you open it and go under ST-LINK->Firmware update.

Click on Device Connect.

You should see the current firware version, and the upgrade to version.

Could you click on Yes to upgrade it ?

The latest driver is V2.J28.M18.

Then, under ST-Link Utility, could you do Target->Connect (you probably need to do it twice) ?

Then are you able to connect. read. erase and flash ?

KR

Sirma

Posted on February 03, 2017 at 07:12

I tried this before it didn't help. The problem is my device is being displayed as a storage device. That's the problem. It never showed as a storage device before. I wonder what's wrong.

Posted on February 03, 2017 at 11:12

Hello Dheeraj,

I think the USB enumeration gives several devices, an UART, the debug port and the storage.

Even an erased device show an storage device.

Let's have another approach...

You said that the printf works under Keil....

I guess under Keil you are able to compile and download, then you success to read something from the virtual com port on your PC... or ?

Kind regards

Sirma

Posted on February 03, 2017 at 14:47

Hello Dheeraj,

I did an interresting experiment.

I built with IAR, and download and debug.

By doing it, IAR keep the openOCD link active.

Then I open the project with Eclipse. I build and try to download.

Then I get following error:

Licensed under GNU GPL v2

For bug reports, read

https://community.st.com/external-link.jspa?url=http%3A%2F%2Fopenocd.org%2Fdoc%2Fdoxygen%2Fbugs.html

Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD

adapter speed: 2000 kHz

adapter_nsrst_delay: 100

srst_only separate srst_nogate srst_open_drain connect_assert_srst

srst_only separate srst_nogate srst_open_drain connect_assert_srst

Info : Unable to match requested speed 2000 kHz, using 1800 kHz

Info : Unable to match requested speed 2000 kHz, using 1800 kHz

Info : clock speed 1800 kHz

Error: libusb_open() failed with LIBUSB_ERROR_ACCESS

Error: open failed

in procedure 'program'

in procedure 'init' called at file 'embedded:startup.tcl', line 473

in procedure 'ocd_bouncer'

** OpenOCD init failed **

shutdown command invoked

The interresting things is that it is the same error as yours.

Are you sure that you do not have the openocd, or any other debug session, active ?

Kind regards

Sirma