cancel
Showing results for 
Search instead for 
Did you mean: 

CUBE HAL C++ Support

shorai
Associate III
Posted on August 21, 2014 at 20:20

Hi, 

    I've been trying to use the new F4 HAL libraries for a project on the F429 Discovery board. 

I realise that this will involve a lot of C to C++ integration.

My first issue is with the two enum typedefs in 

  @file    stm32f4xx_hal_def.h

typedef enum 

{

  HAL_OK       = 0x00,

  HAL_ERROR    = 0x01,

  HAL_BUSY     = 0x02,

  HAL_TIMEOUT  = 0x03

} HAL_StatusTypeDef;

&sharpendif

/** 

  * @brief  HAL Lock structures definition  

  */

typedef enum 

{

  HAL_UNLOCKED = 0x00,

  HAL_LOCKED   = 0x01  

} HAL_LockTypeDef;

These are picked up correctly in an eclipse GCC C project but not in a C++ project.

The message is 'HAL_LockTypeDef 'does not name a type. There are about 500 such messages.

Any ideas as to how to go about either getting the C typedef to be in scope of C++, or of creating something like

&sharpifdef __cplusplus

  //enum  HAL_StatusTypeDef { HAL_OK, HAL_ERROR, HAL_BUSY, HAL_TIMEOUT } ;

 enum  class HAL_StatusTypeDef { HAL_OK, HAL_ERROR, HAL_BUSY, HAL_TIMEOUT } ;

 // typedef enum   { HAL_OK, HAL_ERROR, HAL_BUSY, HAL_TIMEOUT } HAL_StatusTypeDef;

&sharpelse

typedef enum 

{

  HAL_OK       = 0x00,

  HAL_ERROR    = 0x01,

  HAL_BUSY     = 0x02,

  HAL_TIMEOUT  = 0x03

} HAL_StatusTypeDef;

&sharpendif

I would appreciate a pointer to a resource that can lead me through this as I have tried the usual culprits google, cplusplus.com, stacktrace etc 

Thanks in advance

Chris

#c++-hal-typedef-discovery-gcc
7 REPLIES 7
Posted on August 28, 2014 at 15:15

Hi Chris,

The current STM32CubeF4 HAL version does not include the C++ support. We understand that this is a limitation that some of you are experiencing and we've already passed it along to our STM32F4  team.

It will be fixed in next release of STM32CubeF4 by end of september. 

Thanks for the report.

rm239955
Associate II
Posted on January 14, 2015 at 16:42

The original post was too long to process during our migration. Please click on the provided URL to read the original post. https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I6q8&d=%2Fa%2F0X0000000bwZ%2FNSbvFgWD8lrsaMO6IrhQ7SrpVT56ShllZQWRGt6MQdM&asPdf=false
Posted on January 15, 2015 at 14:24

Hi ABCD,

Please write your thread in a separate post.

It has no relation with CUBE HAL C++ Support.

Regards,

Heisenberg.

hbarta2
Associate III
Posted on January 15, 2015 at 15:56

Apologies if you've already tried this.

extern ''C'' {

#include ''stm32f4xx_hal_def.h'' // or whatever #include eventually includes this

}

Does that make any difference?
rm239955
Associate II
Posted on January 15, 2015 at 16:33

Thanks for your reply.I have tried this and I am having the same problem.

While debugging,my CAN messages are not acknowledging and I do no where am I wrong.

rm239955
Associate II
Posted on January 15, 2015 at 16:35

I had already written sir but no one is responsding.I kindly request you to sort this problem out.I have changed the filter and bank numbers and even then I am not able to receive CAN bus message

Posted on January 15, 2015 at 21:10

I had already written sir but no one is responding. I kindly request you to sort this problem out.

Yeah, that's how forums work, you had a thread, now you've hijacked this one, but you still have the same audience. Except now you've pissed in the host's corn flakes. Remember this is YOUR problem, no one else's, demanding others fix it is not the winning strategy.

Step back, stop relying on PCAN, build a CAN network with two nodes, with software you control (plenty of working SPL examples), and hardware that works (plenty of STM32 boards with working CAN designs and schematics). Have them talk to each other, review the traffic on a scope, confirm data rates, etc, and THEN see what PCAN can see/do.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..