2024-01-28 02:27 PM
hello,
I have a syntax error on one line but no compilation error with stm32cubeide 1.14.1
HANDLE_busQuadSPI_CREATE(g_hbusQSPI_storage , &g_hqspi) ; //syntax error
HANDLE_busSPI_CREATE(g_hbusSPI3_interne , &g_hspi3); // no syntax error
with
#define HANDLE_busQuadSPI_CREATE(var, s) \
busQuadSPI_handle_t var = { .quadSpiHal = s, .mutex = NULL , .state = QSPI_STATE_Ndef }
and
#define HANDLE_busSPI_CREATE(var,s) \
busSPI_handle_t var = { .spiHal = s, .mutex = NULL , .state = SPI_STATE_Ndef }
if I don't use macro : no syntax error
busQuadSPI_handle_t g_hbusQSPI_storage = {.quadSpiHal = &g_hqspi , .mutex = NULL , .state = QSPI_STATE_Ndef } ;
HANDLE_busSPI_CREATE(g_hbusSPI3_interne , &g_hspi3);
what can happen?
Thanks in advance
Solved! Go to Solution.
2024-01-29 06:42 AM
I tried to switch to VSC but it only worked for a day, since CMake throws errors all the time, the extension is not well integrated like stm32cubeIDE can be (I have never had the slightest problem compiling or debugging)
On the other hand, I have tried to change syntax coloring in eclipse but dark mode is dysfonctional and by changing each color in the preferences, some of them disappear each time eclipse is restarted... but it's still much better than with the default theme
CubeIDE is well integrated on a bad editor
VScode is a good editor but poorly integrated, maybe tomorrow will be perfect ??
2024-01-29 06:42 AM - edited 2024-01-29 06:45 AM
Could be a general Eclipse thing - not specific to the ST IDE - so try some general Eclipse searches?
eg,
https://www.eclipse.org/forums/index.php/t/75681/
Have you tried the preprocessor thing?
2024-01-29 06:57 AM
I spent hours trying to deactivate this error, including the google example, but I was unsuccessful.
Now, I'm trying to understand what you're telling me about the preprocessor...
I have difficulty understanding because the little I think I know is that the preprocessor concerns GCC but here I have no problem with GCC
2024-01-29 07:02 AM
For vs code I don't use the official STM extension, but stm32-for-vscode by Bureau Moeilijke Dingen (which came first).
KnarfB
2024-01-29 07:08 AM
@po221 wrote:I'm trying to understand what you're telling me about the preprocessor...
At the moment, you're looking at a macro - so the editor is just saying, "somewhere within this macro I think there's a syntax error"
By running it through the preprocessor, you will see the result of expanding the macro - so the editor will be able to show you more precisely where, exactly, it thinks the error is.
When you can see where, exactly, the editor thinks the error is, that may give more clue as to what the editor thinks the error is ...
2024-01-29 07:09 AM
I tried launching the preprocessor with this
I had a lot of not explicit errors (something not configured I would say) but... Eclipse asked me if I wanted to update the "indexes"
I said yes and I no longer have the syntax error :victory_hand:
I still have to understand what these indexes are...
Thank you all for your help
2024-01-29 07:15 AM
@po221 wrote:I had a lot of not explicit errors
What errors, exactly?
Just adding the -E option shouldn't affect anything at all configuration-wise.
Note that this does preprocessing only, so your build will fail - because no object files are generated.
But that doesn't matter - all you need is the preprocessor output.
Rename the .o preprocessor output file to .c, and load that file into the editor.
2024-01-29 07:25 AM
@po221 wrote:I said yes and I no longer have the syntax error :victory_hand:
I missed that bit!
So the Editor had "cached" some sort of "stale" view of your code, and that was leading to it reporting an "error".
As mentioned above, I've seen this happen with other IDEs - it's one of the drawbacks of having the editor trying to do its own "review" of the code - separate from the compiler itself.
If it's working now, please mark the solution.
@po221 wrote:I still have to understand what these indexes are...
It's how the Editor knows where are your definitions, declarations, references, etc are - eg, so that it can do the 'Go To Definition' without having to do a text search through the entire project.
As you've seen, these can get "out-of-date" - which can lead to some strange issues.
2024-01-29 07:30 AM
lol yes these are just build errors :grinning_face_with_sweat:
I just discovered something with the preprocessor and the .o, great!
I could have verified here that the macro was indeed doing the right job earlier
PS : Not obvious the benefit of indexing in Eclipse...
2024-01-29 07:43 AM
The benefit of indexing is that you can just hit a button and instantly go to definition - without having to wait for it to scan the entire project.
etc.