adailtonjn68 / STM32H7xx_inter-core_data_share

MIT License
8 stars 1 forks source link

error: expected ',' or '...' before 'buffer' #2

Open vtpgit opened 1 month ago

vtpgit commented 1 month ago

I tried including the two file in Arduino and this is what I get when I add

In one of the cores the function core_share_init() must be called.

#include "cores_communication.h"
void setup() {
core_share_init();
}
void loop() {}

*In file included from C:\Users\Administrator\Documents\Arduino\GIGA_MemoryShare_Cores_Dev\GIGA_MemoryShare_Cores_Dev.ino:24:0: C:\Users\Administrator\Documents\Arduino\GIGA_MemoryShare_Cores_Dev\cores_communication.h:53:41: error: expected ',' or '...' before 'buffer' int put_to_m4(const int const restrict buffer, const unsigned int size);** ^~ Any ideas what I am doing wrong?

Thank you!

adailtonjn68 commented 1 month ago

I believe it expects a pointer. Use int put_to_m4(const int *const restrict buffer, const unsigned int size); Don't forget the *. For some reason, yours doesn't have it.

I verified and the git repo has it.

adailtonjn68 commented 1 month ago

If it doesn't work, remove all that bloat of const and restrict: int put_to_m4(int * buffer, unsigned int size); And don't forget to also fix the .c file.

vtpgit commented 1 month ago

I believe it expects a pointer. Use int put_to_m4(const int *const restrict buffer, const unsigned int size); Don't forget the *. For some reason, yours doesn't have it.

I verified and the git repo has it.

Mine does have the * pointer, not sure why github deleted it when I copied/pasted. Screenshot attached:

image

I would like to check something else first, this could ne an environment error.

vtpgit commented 1 month ago

OK cleaning the pointers helped, I left only bare pointers.

However when compiling the whole thing barfed like that

Compiling sketch... "C:\Users\Administrator\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4/bin/arm-none-eabi-g++" -c -w -g3 -nostdlib "@C:\Users\Administrator\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.1.5\variants\GIGA/defines.txt" "@C:\Users\Administrator\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.1.5\variants\GIGA/cxxflags.txt" -MMD -mcpu=cortex-m7 -mfloat-abi=softfp -mfpu=fpv5-d16 -DARDUINO=10607 -DARDUINO_GIGA -DARDUINO_ARCH_MBED_GIGA -DARDUINO_ARCH_MBED -DARDUINO_LIBRARY_DISCOVERY_PHASE=0 "-IC:\Users\Administrator\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.1.5\cores\arduino" "-IC:\Users\Administrator\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.1.5\variants\GIGA" -DCM4_BINARY_START=0x60000000 -DCM4_BINARY_END=0x60040000 -DCM4_RAM_END=0x60080000 "-IC:\Users\Administrator\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.1.5\cores\arduino/api/deprecated" "-IC:\Users\Administrator\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.1.5\cores\arduino/api/deprecated-avr-comp" "-iprefixC:\Users\Administrator\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.1.5\cores\arduino" "@C:\Users\Administrator\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.1.5\variants\GIGA/../GIGA/includes.txt" "C:\Users\Administrator\AppData\Local\Temp\arduino\sketches\7DA83D05B035A2E59D288A69BFB51226\sketch\GIGA_MemoryShare_Cores_Dev.ino.cpp" -o "C:\Users\Administrator\AppData\Local\Temp\arduino\sketches\7DA83D05B035A2E59D288A69BFB51226\sketch\GIGA_MemoryShare_Cores_Dev.ino.cpp.o" In file included from C:\Users\Administrator\Documents\Arduino\GIGA_MemoryShare_Cores_Dev\GIGA_MemoryShare_Cores_Dev.ino:25:0: c:\users\administrator\appdata\local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4\lib\gcc\arm-none-eabi\7.2.1\include\stdatomic.h:40:9: error: '_Atomic' does not name a type typedef _Atomic _Bool atomic_bool; ^~~ c:\users\administrator\appdata\local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4\lib\gcc\arm-none-eabi\7.2.1\include\stdatomic.h:41:9: error: '_Atomic' does not name a type typedef _Atomic char atomic_char;

etc... etc...

I'm not sure at that point if it's worth continuing, I might as well rewrite everything from scratch myself.

If you have any ideal please help.

Thank you!

image

adailtonjn68 commented 1 month ago

OK cleaning the pointers helped,

I didn't realize before. Arduino uses g++ to compile and, in C++ there is no restrict keyword up to now (there is talk about adding it in a future revision of the standard).

error: '_Atomic' does not name a type typedef _Atomic _Bool atomic_bool; ^~~

The errors about the _Atomic keyword are because of the inclusion of the <stdatomic.h> header (a C library) I believe. C++ has the <atomic> library and that one should be used. Make this substitution and see if it fixes the problem. Perhaps, you can replace the _Atomic _Bool or atomic_bool for something like std::atomic<bool> (after including the lib <atomic> of course). In this link, there is a workaround https://stackoverflow.com/a/45343624/4885430