This is an old revision of the document!


ewp.py: Create Makefile from IAR project

ewp.py converts as best it can IAR project files into GNU Makefiles.

Install

hg clone https://hg.kewl.org/pub/ewp.py
cd ewp.py
sudo make install

STM32CubeH7 Demo

Fetch Source
git clone --recursive https://github.com/STMicroelectronics/STM32CubeH7
Enter Demo
cd STM32CubeH7/Projects/STM32H745I-DISCO/Applications/FreeRTOS/FreeRTOS_AMP_RTOS_BareMetal/
List Targets
ewp.py . EWARM/Project.ewp
STM32H745I_Discovery_CM4
STM32H745I_Discovery_CM7
Create Makefiles
ewp.py -p1 . EWARM/Project.ewp STM32H745I_Discovery_CM4 > Makefile.cm4
ewp.py -p1 . EWARM/Project.ewp STM32H745I_Discovery_CM7 > Makefile.cm7
Fix Makefiles

For each Makefile alter FIXME_CPU and FIXME_ABI for the CPU platform.

In these cases it is cortex-m4, cortex-m7 and hard.

Locate FIXME_LDS and ensure the correct linker script is selected and then remove the FIXME_LDS text.

Change paths to GCC from IAR in the FreeRTOS source and includes entries.

Patch Source (optional)

Apply this patch if you want the backlight to be disabled when running the demo.

--- CM4/Src/main.c.orig 2024-10-07 13:22:39.704687900 +0100
+++ CM4/Src/main.c      2024-10-07 13:24:31.570592100 +0100
@@ -74,6 +74,15 @@
      */
   HAL_Init();

+  __HAL_RCC_GPIOK_CLK_ENABLE();
+  GPIO_InitTypeDef GPIO_InitStruct = {0};
+  GPIO_InitStruct.Mode  = GPIO_MODE_OUTPUT_PP;
+  GPIO_InitStruct.Pull  = GPIO_NOPULL;
+  GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_MEDIUM;
+  GPIO_InitStruct.Pin   = GPIO_PIN_0;
+  HAL_GPIO_Init(GPIOK, &GPIO_InitStruct);
+  HAL_GPIO_WritePin(GPIOK, GPIO_PIN_0, GPIO_PIN_RESET);
+
   BSP_LED_Init(LED1);
   BSP_LED_Init(LED2);
Build
make -f Makefile.cm4
make -f Makefile.cm7
Combine HEX
srec_cat build/STM32H745I_Discovery_CM7/STM32H745I_Discovery_CM7.hex -Intel build/STM32H745I_Discovery_CM4/STM32H745I_Discovery_CM4.hex -Intel -out Project.hex -Intel
Program

Program `Project.hex' with STM32CubeProgrammer (attempt using OpenOCD failed and need investigation).

Notes

The demo FreeRTOS_AMP_Dual_RTOS initially runs ok and then stalls so it would appear to be buggy. FreeRTOS_AMP_RTOS_BareMetal works fine.

A work-in-progress port using this script can be found here.

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies