Skip to main content
LZhen.5
Associate
Feb 28, 2022 7:27 AM UTC
Question

Now I am using STM32F407ZGT6,In all files ,I cann't find "# define STM32F40_41xxx",but in many places ,it need to use "#if defined (STM32F40_41xxx)" as MACRO .Why ?

..

This topic has been closed for replies.

10 replies

KnarfB
Super User
Feb 28, 2022 7:54 AM UTC

What compiler / IDE? Did you generate the code?

The MCU type like STM32F40_41xxx is defined in the complier command line, not in the source code.

hth

KnarfB

LZhen.5
LZhen.5Author
Associate
Feb 28, 2022 11:29 AM UTC

I use Keil5 and J-link platform,the programme can run normally,I'm learning the rules about the MCU now.according my understanding,the "#define STM32F40_41xxx" Macro must be writed in a head file(.h file),why is not there in whole project files?

LZhen.5
LZhen.5Author
Associate
Feb 28, 2022 11:33 AM UTC

0693W00000KamihQAB.jpg

LZhen.5
LZhen.5Author
Associate
Feb 28, 2022 11:40 AM UTC

0693W00000KamoVQAR.jpg

LZhen.5
LZhen.5Author
Associate
Feb 28, 2022 11:44 AM UTC

Is the selection below can instead of the  "# define STM32F40_41xxx" Macro?0693W00000KamtpQAB.jpg

LZhen.5
LZhen.5Author
Associate
Feb 28, 2022 11:50 AM UTC

Mr. KnarfB,thank you for your reply. excuse me ,do you speak Chinese, because my English is poor.

waclawek.jan
Super User
Feb 28, 2022 6:38 PM UTC

I don't use Keil, but maybe this is the information you are looking for https://www.keil.com/support/man/docs/uv4/uv4_dg_adscc.htm

JW

LZhen.5
LZhen.5Author
Associate
Mar 2, 2022 8:24 PM UTC
Thank you for your reply.Now I understand the reason ,just like you gived the "arm keil" issue. At 2022-03-01 02:38:03, "ST Community" wrote: What IDE are you using? Maybe this is the information you are looking for https://www.keil.com/support/man/docs/uv4/uv4_dg_adscc.htm JW waclawek.jan (Community Member) What IDE are you using? Maybe this is the information you are looking for https://www.keil.com/support/man/docs/uv4/uv4_dg_adscc.htm JW or reply to this email Replying to LZhen.5 (Community Member) asked a question. Sunday, February 27, 2022 11:27 PM Now I am using STM32F407ZGT6,In all files ,I cann't find "# define STM32F40_41xxx",but in many places ,it need to use "#if defined (STM32F40_41xxx)" as MACRO .Why ? waclawek.jan (Community Member) What IDE are you using? Maybe this is the information you are looking for https://www.keil.com/support/man/docs/uv4/uv4_dg_adscc.htm JW Monday, February 28, 2022 10:38 AM You're receiving emails when someone "Comments on my posts." To change or turn off ST Community email, log in as lzstry@163.com.st. Are notifications about this post getting annoying? Reply to this email with the word " mute ". STMicroelectronics N.V.
Pavel A.
Feb 28, 2022 8:30 PM UTC

@LZhen.5​ Are you sure that this macro is defined? If you cannot find where it is defined, perhaps it simply is not. Try this:

#ifndef STM32F40_41xxx

#error

#endif

LZhen.5
LZhen.5Author
Associate
Mar 2, 2022 8:34 PM UTC
Thanks for your help.The problem has been solved.The Macro Statement has been set in Keil Setting part. At 2022-03-01 04:30:23, "ST Community" wrote: @LZhen.5 Are you sure that this macro is defined? If you cannot find where it is defined, perhaps it simply is not. Try this: #ifndef STM32F40_41xxx #error #endif Pavel A. (Community Member) @LZhen.5 (Community Member) Are you sure that this macro is defined? If you cannot find where it is defined, perhaps it simply is not. Try this: #ifndef STM32F40_41xxx #error #endif or reply to this email Replying to LZhen.5 (Community Member) asked a question. Sunday, February 27, 2022 11:27 PM Now I am using STM32F407ZGT6,In all files ,I cann't find "# define STM32F40_41xxx",but in many places ,it need to use "#if defined (STM32F40_41xxx)" as MACRO .Why ? Pavel A. (Community Member) @LZhen.5 (Community Member) Are you sure that this macro is defined? If you cannot find where it is defined, perhaps it simply is not. Try this: #ifndef STM32F40_41xxx #error #endif Monday, February 28, 2022 12:30 PM You're receiving emails when someone "Mentions me in a comment." To change or turn off ST Community email, log in as lzstry@163.com.st. STMicroelectronics N.V.