Loading...
 

SW4STM32 and SW4Linux fully supports the STM32MP1 asymmetric multicore Cortex/A7+M4 MPUs

   With System Workbench for Linux, Embedded Linux on the STM32MP1 family of MPUs from ST was never as simple to build and maintain, even for newcomers in the Linux world. And, if you install System Workbench for Linux in System Workbench for STM32 you can seamlessly develop and debug asymmetric applications running partly on Linux, partly on the Cortex-M4.
You can get more information from the ac6-tools website and download (registration required) various documents highlighting:

System Workbench for STM32


How to add files to an MX generated project

Hi folks,
I’m afraid my lack of experience with Eclipse and the framework has me stymied. This question actualy has two sides.

First I wanted to add a BSP file to support the LCD (on an STM32F429I-DISCO.) It was not obvious where it should go in what seems to be a pretty elaborate directory structure. When working in Java, my recollection is that new files just appeared and were compiled and linked into the executable. That didn’t seem to work here until I added it to:

Blink02MX/SW4STM32/Blink02MX Configuration/user

It’s not obvious to me that this is the “right” place to add a library file, but it gets compiled and linked.

The second issue is HAL library files. This BSP driver uses the DMA2D library. I can see the file in

Blink02MX/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma2d.c

but it is not included in

barta@yggdrasil ~/Documents/ecl-ws/Blink02MX $ cat './SW4STM32/Blink02MX Configuration/Debug/objects.list'
./user/stm32f429i_discovery_lcd.o
./user/syscalls.o
./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal.o
./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_cortex.o
./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_dma.o
./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_dma_ex.o
./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_flash.o
./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_flash_ex.o
./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_flash_ramfunc.o
./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_gpio.o
./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_i2c.o
./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_i2c_ex.o
./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_ltdc.o
./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_pwr.o
./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_pwr_ex.o
./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_rcc.o
./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_rcc_ex.o
./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_sdram.o
./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_spi.o
./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_ll_fmc.o
./Drivers/CMSIS/system_stm32f4xx.o
./Application/User/main.o
./Application/User/stm32f4xx_hal_msp.o
./Application/User/stm32f4xx_it.o
./Application/SW4STM32/startup_stm32f429xx.o
hbarta@yggdrasil ~/Documents/ecl-ws/Blink02MX $

I suppose I could move the HAL files to the same location where I put the BSP file but I think there must be some place where it gets added to the list of other HAL library files that are compiled and linked. Where is that?

Thanks!

Edit: I keep digging. I found the .project file that seems to include all of the source files. I added stm32f4xx_hal_dma2d.c to the list. Now it compiles - there is a .o file. It is included in objects.list file so it should be included in the executable. The related unresolved references remain unresolved. :-(

Maybe I should be asking how to resolve:

Invoking: MCU GCC Linker
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=soft -T"../STM32F429ZITx_FLASH.ld" -Wl,-Map=output.map -Wl,--gc-sections -o "Blink02MX Configuration.elf" @"objects.list"  
./user/stm32f429i_discovery_lcd.o: In function `BSP_LCD_Init':
/home/hbarta/Documents/ecl-ws/Blink02MX/SW4STM32/Blink02MX Configuration/Debug/../user/stm32f429i_discovery_lcd.c:229: undefined reference to `BSP_SDRAM_Init'
/home/hbarta/Documents/ecl-ws/Blink02MX/SW4STM32/Blink02MX Configuration/Debug/../user/stm32f429i_discovery_lcd.c:235: undefined reference to `ili9341_drv'
./user/stm32f429i_discovery_lcd.o: In function `FillBuffer':
/home/hbarta/Documents/ecl-ws/Blink02MX/SW4STM32/Blink02MX Configuration/Debug/../user/stm32f429i_discovery_lcd.c:1340: undefined reference to `HAL_DMA2D_Init'
/home/hbarta/Documents/ecl-ws/Blink02MX/SW4STM32/Blink02MX Configuration/Debug/../user/stm32f429i_discovery_lcd.c:1342: undefined reference to `HAL_DMA2D_ConfigLayer'
/home/hbarta/Documents/ecl-ws/Blink02MX/SW4STM32/Blink02MX Configuration/Debug/../user/stm32f429i_discovery_lcd.c:1344: undefined reference to `HAL_DMA2D_Start'
/home/hbarta/Documents/ecl-ws/Blink02MX/SW4STM32/Blink02MX Configuration/Debug/../user/stm32f429i_discovery_lcd.c:1347: undefined reference to `HAL_DMA2D_PollForTransfer'
collect2: error: ld returned 1 exit status
make: *** [Blink02MX Configuration.elf] Error 1


They’re in the HAL dma2d file:

hbarta@yggdrasil ~/Documents/ecl-ws/Blink02MX $ egrep "HAL_DMA2D_Init|HAL_DMA2D_ConfigLayer|HAL_DMA2D_Start|HAL_DMA2D_PollForTransfer" Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma2d.c
          HAL_DMA2D_Init() function.
          and the input offset using HAL_DMA2D_ConfigLayer() function for foreground
           the transfer using HAL_DMA2D_Start() 
       (+) Wait for end of transfer using HAL_DMA2D_PollForTransfer(), at this stage
           the transfer using HAL_DMA2D_Start_IT() 
HAL_StatusTypeDef HAL_DMA2D_Init(DMA2D_HandleTypeDef *hdma2d)
HAL_StatusTypeDef HAL_DMA2D_Start(DMA2D_HandleTypeDef *hdma2d, uint32_t pdata, uint32_t DstAddress, uint32_t Width,  uint32_t Height)
HAL_StatusTypeDef HAL_DMA2D_Start_IT(DMA2D_HandleTypeDef *hdma2d, uint32_t pdata, uint32_t DstAddress, uint32_t Width,  uint32_t Height)
HAL_StatusTypeDef HAL_DMA2D_PollForTransfer(DMA2D_HandleTypeDef *hdma2d, uint32_t Timeout)
HAL_StatusTypeDef HAL_DMA2D_ConfigLayer(DMA2D_HandleTypeDef *hdma2d, uint32_t LayerIdx)


It’s called out in the linker file

hbarta@yggdrasil ~/Documents/ecl-ws/Blink02MX $ grep dma2d 'SW4STM32/Blink02MX Configuration/Debug/objects.list'
./Drivers/STM32F4xx_HAL_Driver/stm32f4xx_hal_dma2d.o
hbarta@yggdrasil ~/Documents/ecl-ws/Blink02MX $


I remain baffled. confused

I still struggle with some of this myself but,
possibly I can offer some thoughts.

I have been twiddling with the STM32CubeMX and System Workbench, and I find that the STM32CubeMX structure is good for me.

It putes the BSP in the Application/User folder where one also finds main.

Most of the files listed in the project appear to be in virtual directories, that is, I see them in Eclipse in one way and if I look on the disk drive, they are in different places.

I found that you must use the import to bring in more .c files and also .h files, after some experiemnting with the import and multiple failed attmpts, I seem to be able to duplicate my efforts with some twiddling.

Once you get used to Eclipse, the rest should fall into place.


You can add user folders and files to Eclipse project. It is nothing to do with ac6. To add folder or file, right click project and select folder or file. The easiest way is to copy folder/files from somewhere and and pase to project. ac6 will auto generate make file inside added folder. Do not forget to add user include path to project by right clicking project, and then popup Properties Configuration Window, Select C/C++ General, Path and Symbols, Includes Tab.

ac6 make file lacks dependency, so you may add -MT”$@” into Properties/C/C++ Build/Settings/Tool Settings/MCU GCC Compiler/Miscellaneou/Other flags.

I suggest not use ac6 auto generated make files, write your own make file to do what you want. Also it seems the STM32CubeMX directory structure is not so good to fit EClipse CDT.

Thank you both for your helpful suggestions. I look forward to getting this resolved!

I do hope that MX output can be integrated into Eclipse via ac6 as I find both MX and Workbench to be useful tools.

Thanks!


France

Hi folks,
The problem you have, if you want to manually add support for additional firmwares in a CubeMX-generated project, for now, is due to the way CubeMX creates the Ac6 System Workbench project: if places the project in a sub-directory (SW4STM32/project Configuration), where it creates sub-trees (Application, Drivers) in which it links the needed source files, keeping the original files in folders you do not see as they are not in the project.

So to add an HAL driver to your project you should:

  1. Drivers/STM32xxxxx_HAL_Driver >> New >> File
  2. In the dialog that opens click on Advanced then Link to file in the file system
    Link File To Project Dialog
  3. Then click Variables...
    Select File With Variable
  4. Click Extend... to be able to brows your system starting from the selected location (here the current workspace)
    Extending A Variable
  5. Select the file you need (here stm32f4xx_hal_cryp.c), then clivk OK and Finish

Now your new driver will be included in the project and compiled although it will not be initialized or configured, and you will have to take care of this manually...

So another way to go may be to use CubeMX; however this suppose that you only modify CubeMX-generated files in the sections bracketted by /* USER xxxx BEGIN */ and /* USER xxxx END */ comments (otherwise your changes will be overwriten by CubeMX):

  1. Close your project in Ac6 System Workbench for STM32 (project >> Close Project)
    • You may also close Ac6 System Workbench for STM32 itself
  2. Reopen your CubeMX project (the .ioc file)
  3. Modify your CubeMX project
    • Add the new devices and/or firmwares,
    • Assign pins to the new devices
    • Change configuration settings for your project
  4. Re-generate your project
  5. Re-open your project

Then all the changes you’ve done in CubeMX will appear in Ac6 System Workbench for STM32 and initialization code will be present to configure and initialize your new devices.

Hope this helps,

Bernard


Yes - thanks - that information is very helpful.
I second that. very useful