cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeMX 4.19.0 Code generation issue

petoknm
Associate II
Posted on February 26, 2017 at 19:34

Hi.

I have noticed some problems when generating code using STM32CubeMX 4.19.0. I included the zipped project in the attachments. In the Src/main.c file it generates the declaration of the FSMC init function

static void MX_FSMC_Init(void);

but it is never defined. All the other functions get properly defined below the main function but this one does not. It would really help to have this code generated since using FSMC is tricky.

There is also a second issue with the code generation. I have set up a DMA Memory to memory transfer and it generated some code for it but it didn't define the variable is uses. I had to put the variable definition manually in my private global variable definitions.

static void MX_DMA_Init(void) {

   ...

   hdma_memtomem_dma2_stream0.Instance = DMA2_Stream0; /* <------ 

hdma_memtomem_dma2_stream0 is undefined 

*/

   ...

#sram #dma #stm32cubemx #fsmc #code-generation
4 REPLIES 4
Nesrine M_O
Lead II
Posted on February 27, 2017 at 10:22

Hi

,

I'am not able to see your issue:

  1. In the Src/main.c file it generates the declaration of the FSMC init function

    but it is never defined:

    * FSMC initialization function */static void MX_FSMC_Init(void){ FSMC_NORSRAM_TimingTypeDef Timing;/** Perform the SRAM1 memory initialization sequence */ hsram1.Instance = FSMC_NORSRAM_DEVICE; hsram1.Extended = FSMC_NORSRAM_EXTENDED_DEVICE; /* hsram1.Init */ hsram1.Init.NSBank = FSMC_NORSRAM_BANK1; hsram1.Init.DataAddressMux = FSMC_DATA_ADDRESS_MUX_ENABLE; hsram1.Init.MemoryType = FSMC_MEMORY_TYPE_PSRAM; hsram1.Init.MemoryDataWidth = FSMC_NORSRAM_MEM_BUS_WIDTH_8; hsram1.Init.BurstAccessMode = FSMC_BURST_ACCESS_MODE_DISABLE; hsram1.Init.WaitSignalPolarity = FSMC_WAIT_SIGNAL_POLARITY_LOW; hsram1.Init.WrapMode = FSMC_WRAP_MODE_DISABLE; hsram1.Init.WaitSignalActive = FSMC_WAIT_TIMING_BEFORE_WS; hsram1.Init.WriteOperation = FSMC_WRITE_OPERATION_ENABLE; hsram1.Init.WaitSignal = FSMC_WAIT_SIGNAL_DISABLE; hsram1.Init.ExtendedMode = FSMC_EXTENDED_MODE_DISABLE; hsram1.Init.AsynchronousWait = FSMC_ASYNCHRONOUS_WAIT_DISABLE; hsram1.Init.WriteBurst = FSMC_WRITE_BURST_ENABLE; hsram1.Init.PageSize = FSMC_PAGE_SIZE_NONE; /* Timing */ Timing.AddressSetupTime = 15; Timing.AddressHoldTime = 15; Timing.DataSetupTime = 255; Timing.BusTurnAroundDuration = 15; Timing.CLKDivision = 16; Timing.DataLatency = 2; Timing.AccessMode = FSMC_ACCESS_MODE_A; /* ExtTiming */if (HAL_SRAM_Init(&hsram1, &Timing, NULL) != HAL_OK) { Error_Handler(); }}�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?

  2. I have set up a DMA Memory to memory transfer and it generated some code for it but it didn't define the variable is uses:

/* Private variables ---------------------------------------------------------*/DMA_HandleTypeDef hdma_memtomem_dma2_stream0;SRAM_HandleTypeDef hsram1;�?�?�?�?�?�?�?

-Nesrine-

Posted on February 27, 2017 at 21:39

I should have specified that I encountered the issue on Linux. Now I tested it on Windows and it seems to work fine. Can you please test it on Linux?

Posted on February 28, 2017 at 10:10

Hi

Majchrak.Peter

,

The issue has been reported internally for checking .Sorry for the inconvenience it may bring

-Nesrine-

Posted on March 28, 2017 at 10:53

Hello Peter,

I would like to thank you for your bug report.

We have noticed some uppercase letters in some temporary files.

As windows does not care between upper/lower case, this cannot be seen under Win machines.

This will be corrected in CubeMX4.21

Kind regards

Sirma