Error connecting Custom DLL to STM32F302R8 GPIO or PWM

Osei Kay
Osei Kay Altair Community Member
edited June 2022 in Community Q&A

I created a custom DLL to be used in Altair Embed 2021.1. The user block works fine if it runs alone. But when I try to download it to STM32F302R8, I get  an error:

" C:\Altair\Embed2021\cg/Diagram1_21.c:41: undefined reference to `cgMain'

c:/program files (x86)/gnu arm embedded toolchain/10 2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: Diagram1_21.o: in function `main':

C:\Altair\Embed2021\cg/Diagram1_21.c:77: undefined reference to `cgMainSS' c:/program files (x86)/gnu arm embedded toolchain/10 2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe:

imageC:\Altair\Embed2021\cg/Diagram1_21.c:80: undefined reference to `cgMainSE' collect2.exe: error: ld returned 1 exit status".

I have attached a screenshot of the message. Any help?

Welcome!

It looks like you're new here. Sign in or register to get started.

Answers

  • Girish Karamadi_21849
    Girish Karamadi_21849 New Altair Community Member
    edited June 2022

    User Blocks works for simulation not for codegen . 

    May I know what are you trying to achieve??

    Regards,

    Girish

  • Osei Kay
    Osei Kay Altair Community Member
    edited June 2022

    I appreciate your response. 

    I am trying to implement a controller for a motor. I am trying to implement an advanced controller, that requires complex algorithms that cannot be easily implemented using the blocks. I have written the code in C/C++. 

    Any help or suggestions will be appreciated. 

    Regards,

    Kay

  • Girish Karamadi_21849
    Girish Karamadi_21849 New Altair Community Member
    edited June 2022

    You can use extern blocks to use the external code. Attached the simple example using extern block.

     

    Regards,

    Girish

  • Osei Kay
    Osei Kay Altair Community Member
    edited June 2022

    Okay. I will try that. I will update this platform on the response. 

Welcome!

It looks like you're new here. Sign in or register to get started.

Welcome!

It looks like you're new here. Sign in or register to get started.