-
Notifications
You must be signed in to change notification settings - Fork 407
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
compiler error #265
Comments
Really hard to guess what the problem is without having a bit more of your code. But from the error message it looks like you don't have the right function prototypes. Just look for spiffs_read how it is defined. If SPIFFS_HAL_CALLBACK_EXTRA is 0, it is: Your function seems to return void, but it should look like this:
|
Compiler IAR ARM. I tested all the options listed on the documentation page. The error does not go away. It was possible to fix this only by forced type conversion.
The compiler probably cannot match types due to the use of macros. |
Casting the funtion pointers is not a good idea. It only hides the problem. Why shouldn't the compile be able to handle macros? The error message says, your read function looks like this: There are at least 4 errors:
Please note that the |
/* void my_spi_read(int addr, int size, char *buf) } void my_spi_write(int addr, int size, char *buf) } void my_spi_erase(int addr, int size) } static s32_t my_spiffs_read(u32_t addr, u32_t size, u8_t dst) static s32_t my_spiffs_write(u32_t addr, u32_t size, u8_t src) static s32_t my_spiffs_erase(u32_t addr, u32_t size) void my_spiffs_mount(void)
// printf("mount res: %i\n", res); |
It is, as I suspected. Your functions do not have the right signatures. Just change them to exactly match the typedefs in spiffs.h:
Here is what I can see in your code:
|
Internal functions (my_spi_read etc) are not important, they are just stubs. The main code does not compile even if I delete them. In any case, thanks for the answers. |
It's not my library. Just answering your question. Yes, I know that my_spi_read (etc) are stubs. I did not talk about them. The error is in my_spiffs_read (etc) having incorrect parameter types. In your original post you are using my_spi_read (etc) for the config struct. Which completely matches the compiler error. If you used the corrected versions of my_spiffs_read (etc) the error will disappear. Don't know if LittleFS takes less memory. I don't have any experience with it. |
Example strings:
cfg.hal_read_f = my_spi_read;
cfg.hal_write_f = my_spi_write;
cfg.hal_erase_f = my_spi_erase;
Error: a value of type "void (*)(int, int, char )" cannot be assigned to an entity of type "spiffs_read"
Error: a value of type "void ()(int, int, char )" cannot be assigned to an entity of type "spiffs_write"
Error: a value of type "void ()(int, int)" cannot be assigned to an entity of type "spiffs_erase"
The text was updated successfully, but these errors were encountered: