-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Preprocessor symbols not handled correctly when compiling via IDE in Windows instead of command line #2922
Comments
No such issue, just Embedded Studio can't handle code highlighting correctly, so it appears STM32F1 is chosen. |
Can't disagree more with this assessment. The next failure I find in SES' symbol highlighting will be the first one. You can sit there and add & remove symbols on the fly and the highlighting will correctly update even if you don't save the file. Also, if you read what was written you will find absolutely NO mention of the highlighting, so it's not clear why that was even brought up. All of the points I raised have nothing to do with how SES or any IDE is highlighting code. Once again, the header path for |
CFG_TUSB_MCU=OPT_MCU_STM32C0 but F1 is highlighted:
Header files should NOT be compiled directly ! https://stackoverflow.com/questions/17416719/do-i-need-to-compile-the-header-files-in-a-c-program TinyUSB is supported by all major IDEs like IAR, MDK ARM, SES, STM32CubeIDE, MCUXpresso, etc. |
Thank you for the clarifications. The reason you're seeing that apparent "error" is that even though CFG_TUSB_MCU=OPT_MCU_STM32C0 is set, none of the OPT_MCU symbols exist at that stage. The preprocessor will replace CFG_TUSB_MCU with OPT_MCU_STM32C0, so the expression you have highlighted there equates to "#if OPT_MCU_STM32C0 == OPT_MCU_STM32F1". As none of the OPT_MCU symbols exist yet, this is "#if (not defined) == (not defined)", so the highlighting is correct. If you add I clearly said "if files USING that header are compiled..." not "if header files are compiled", so it's not clear to me why you think I might be compiling header files directly by themselves. This would seem to be "working" because it's Thank you again for your time reviewing this issue. |
Operating System
Windows 11
Board
all
Firmware
n/a
What happened ?
Tinyusb appears to expect symbol CFG_TUSB_MCU to be set via command line or some make file as a
#define
for it isn't present in the source files. This may be fine when compiling from a shell prompt via Linux but causes issues when compiling the code as I do via an IDE in Windows (specifically, Segger Embedded Studio).In the project settings I have a
CFG_TUSB_MCU=OPT_MCU_STM32F4
entry that gets me past the errors whereCFG_TUSB_MCU
is not defined, however, this doesn't mean everything is correct even though the code compiled with zero errors or warnings. In filedwc2_stm32.h
the#if ... #elif
chains don't evaluate correctly because none of theOPT_MCU
symbols have been defined yet. To correct this issue I had to add#include "tusb_option.h"
to the start of the file as its include chain doesn't have that in there. I'm left wondering how many other things in the code might also be incorrect because of this issue. It might be advisable to make sure more of these files route their headers up totusb_config.h
to cover this and ensure that there are no symbols being defined outside the scope of the source files.How to reproduce ?
Compile the code via an IDE instead of from a shell prompt.
Debug Log as txt file (LOG/CFG_TUSB_DEBUG=2)
n/a.
Screenshots
No response
I have checked existing issues, dicussion and documentation
The text was updated successfully, but these errors were encountered: