cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeMX Feature missing? User labels

mklatt9
Associate II
Posted on April 15, 2015 at 11:52

Hello,

perhaps I missed something... Is it correct, that the user labels in CubeMX are not used in the generated code? I've seen this in other code configurator tools. I didn't found a way to benefit from the pin definitions in the code, like ''LED_RED''.

If this is not implemented, this is a great feature! I know tools which writes a pin definition file with a bunch of defines like PIN_LED_RED_SetHigh(), PIN_LED_RED_Toggle(),

PIN_LED_RED_SetAsOutput(), PIN_LED_RED_EnablePullUp()

and so on for the correct replacement with the already mapped HAL functions, pins and ports.

Thanks for any help.

Greetings

STM32CubeMX 4.7.0 / HAL F4 1.5.0 / STM32F407

#user-labels #feature #stm32cube #solved
14 REPLIES 14
vromanov
Associate II
Posted on April 15, 2015 at 12:50

I vote for this feature!

Svenn Dahlstrom
Associate III
Posted on April 15, 2015 at 15:17

I also vote for this!

stm32cube-t
Senior III
Posted on April 29, 2015 at 19:08

Dear All,

Thank you for your feedback. Indeed, this feature is not implemented yet but the request has been logged.

Can you actually state what you would like to be generated (other than only the label).

Here are some suggestions below (is this useful, other things you may want to add?):

With Label BLUE_LED, generate for example

#define BLUE_LED 

#define BLUE_LED_PIN                                GPIO_PIN_12

#define BLUE_LED_GPIO_PORT                          GPIOD

With 

USARTx_TX and USARTx_RX

Labels

 generate :

#define USARTx                           USART1

#define USARTx_AF                     GPIO_AF7_USART1

#define USARTx_TX_PIN                    GPIO_PIN_9

#define USARTx_TX_GPIO_PORT              GPIOA 

#define USARTx_RX_PIN                    GPIO_PIN_10

#define USARTx_RX_GPIO_PORT              GPIOA

Best regards

I also vote for this!

childresss
Associate II
Posted on April 29, 2015 at 20:44

I use the coding technique shown above. My current project has many ports and pins defined this way.

It all has to be done manually. And when I change a port/pin/alternate function in CubeMX, I have to manually edit the changes into my .h file to keep things in sync. It's error prone.

CubeMX needs to generate .h file code based on user labels.

vromanov
Associate II
Posted on April 29, 2015 at 22:48

My variant

#define BLUE_LED

GPIOD,

GPIO_PIN_12

#define BLUE_LED_PIN                                GPIO_PIN_12

#define BLUE_LED_GPIO_PORT                          GPIOD

in this case you can use:

HAL_GPIO_WritePin(BLUE_LED, GPIO_PIN_SET)

HAL_GPIO_ReadPin(

BLUE_LED

)

Osto
Senior
Posted on April 30, 2015 at 01:03

Hi,

This would be a huge help but  the comment from Vladimir is better.

Regards,

Osto

JulienD
Senior
Posted on May 09, 2015 at 19:32

Vote for too.

dpfeffer9
Associate II
Posted on November 13, 2015 at 17:31

Where are the definitions stored?

mklatt9
Associate II
Posted on October 04, 2016 at 12:16

Hey cool,

I'm very happy to see, that my original feature request was implemented for a while and now I and many others benefit from this. :-)))

After some posts from me rebuking the lack of a bug tracker and some other annoying bugs (yes, first one is also a bug :) ), I want to say THANK YOU - really good done. After checking the generated code I saw that CubeMX even uses that generated labels in a really good way in the initialization codes. Very well done!!

Please could at least five of you at ST go to that person who has improved the software this much, pat him or her on the back and forward my and many other user's happiness and praise?

Too bad, that there is no good way to tag this as solved, so that everyone can see ''feature, discussion, solved in version xy'' :| . This would be a good entry for such a list...

Thanks, MK