cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 using Simulink and TrueSTUDIO

Xxone
Associate

Hello there,

I'm trying to set up a STM32F4 Discoveryboard with Simulink.

My Toolchain contains CobeMX, Simulink, Embedded Coder

and TrueSTUDIO. I just wanted to Control an LED using a Signal Generator block:

test.c

/* Model step function */

void test_step(void)

{

test_B.PulseGenerator = ((test_DW.clockTickCounter < 1000) &&

(test_DW.clockTickCounter >= 0));

if (test_DW.clockTickCounter >= 2999) {

test_DW.clockTickCounter = 0;

} else {

test_DW.clockTickCounter++;

}

/* S-Function Block: <Root>/STM32_Config */

/* S-Function Block: <Root>/GPIO_Write */if (test_B.PulseGenerator == 0)

HAL_GPIO_WritePin(GPIOD, GPIO_PIN_14, GPIO_PIN_RESET);

else

HAL_GPIO_WritePin(GPIOD, GPIO_PIN_14, GPIO_PIN_SET);

//

}

/* Model initialize function */

void test_initialize(void)

{

/* Registration code */

/* initialize error status */

rtmSetErrorStatus(test_M, (NULL));

/* block I/O */

(void) memset(((void *) &test_B), 0,

sizeof(B_test));

/* states (dwork) */

(void) memset((void *)&test_DW, 0,

sizeof(DW_test));

test_DW.clockTickCounter = 0;

}

Unfortunatly when I compile the Code i get following erros:

.......startup\startup_stm32f407xx.o -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -T../STM32F407VG_FLASH.ld -specs=nosys.specs -static -Wl,-Map=test3.map -Wl,--gc-sections -Wl,--defsym=malloc_getpagesize_P=0x80 -Wl,--start-group -lc -lm -Wl,--end-group -specs=nano.specs

Src\main.o: In function `main':

C:\Users\Desktop\stm32board_test\test3\Debug/..\Src/main.c:149: undefined reference to `test_initialize'

C:\Users\Desktop\stm32board_test\test3\Debug/..\Src/main.c:166: undefined reference to `test_step'

Src\main.o: In function `SysTick_Config':

C:\Users\Desktop\stm32board_test\test3\Drivers\CMSIS\Include/core_cm4.h:2031: undefined reference to `test_M'

collect2.exe: error: ld returned 1 exit Status

I don't know C that well so i hope you can help me 🙂

Thanks

1 REPLY 1
Cyril FENARD
ST Employee

Hi @Xxone​ ,

The version 5.1.0 of STM32-MAT/TARGET has just been released at the end of July 2019.

As far the toolchain is concerned there are known issues with eclipse-based tools, especially for include paths and build resources that can be defined as excluded.

It is an issue with the project generator that is used.

In the current situation, in the project generated for these types of IDEs, check the include parameters for the paths and verify that the build resource is also enabled.

Sorry for the disturbance.

Regards.

Cyril