ElectronicCats / flipper-MCP2515-CANBUS

MCP2515 CANBUS project to the Flipper Zero
MIT License
42 stars 4 forks source link

Compile Errors #1

Closed RogueMaster closed 1 month ago

RogueMaster commented 1 month ago

Hi Guys,

Got your device at Defcon, excited to try it out... you seem to have some compile issues...

In function 'set_registerS', inlined from 'write_mf' at applications\external\canbus\libraries\mcp_can_2515.c:96:5: applications\external\canbus\libraries\mcp_can_2515.c:33:20: error: array subscript 2 is above array bounds of 'uint8_t[2]' {aka 'unsigned char[2]'} [-Werror=array-bounds] 33 | instruction[i + 2] = data[i]; | ~~~^~~ applications\external\canbus\libraries\mcp_can_2515.c: In function 'write_mf': applications\external\canbus\libraries\mcp_can_2515.c:29:13: note: while referencing 'instruction' 29 | uint8_t instruction[] = {INSTRUCTION_WRITE, address}; | ^~~ In function 'set_registerS', inlined from 'write_mf' at applications\external\canbus\libraries\mcp_can_2515.c:96:5: applications\external\canbus\libraries\mcp_can_2515.c:33:28: error: '__builtin_memcpy' offset [2, 5] is out of the bounds [0, 2] of object 'instruction' with type 'uint8_t[2]' {aka 'unsigned char[2]'} [-Werror=array-bounds] 33 | instruction[i + 2] = data[i]; | ~~~~~^~~ applications\external\canbus\libraries\mcp_can_2515.c: In function 'write_mf': applications\external\canbus\libraries\mcp_can_2515.c:29:13: note: 'instruction' declared here 29 | uint8_t instruction[] = {INSTRUCTION_WRITE, address}; | ^~~ applications\external\canbus\scenes\snifferoption.c: In function 'save_data_on_log': applications\external\canbus\scenes\snifferoption.c:73:27: error: the comparison will always evaluate as 'true' for the address of 'log_file_path' will never be NULL [-Werror=address] 73 | if(app->log_file_path != NULL) { | ^~ In file included from applications\external\canbus\scenes\snifferoption.c:1: applications\external\canbus\scenes../app_user.h:58:10: note: 'log_file_path' declared here 58 | char log_file_path[100]; | ^~~~~ applications\external\canbus\scenes\snifferoption.c: In function 'save_address_data_on_log': applications\external\canbus\scenes\snifferoption.c:89:27: error: the comparison will always evaluate as 'true' for the address of 'log_file_path' will never be NULL [-Werror=address] 89 | if(app->log_file_path != NULL) { | ^~ applications\external\canbus\scenes../app_user.h:58:10: note: 'log_file_path' declared here 58 | char log_file_path[100]; | ^~~~~

xpeqex commented 1 month ago

Hey @RogueMaster

May I know the firmware version are you using to compile the app?

sabas1080 commented 1 month ago

version 1.1.1.0 working with SDK77 now @RogueMaster, thanks

RogueMaster commented 1 month ago

On latest dev from OFW, UL and RM firmware this code has compile issues.

RogueMaster commented 1 month ago

This error is present in current build:

In function 'set_registerS', inlined from 'write_mf' at applications\external\canbus\libraries\mcp_can_2515.c:96:5: applications\external\canbus\libraries\mcp_can_2515.c:33:20: error: array subscript 2 is above array bounds of 'uint8_t[2]' {aka 'unsigned char[2]'} [-Werror=array-bounds] 33 | instruction[i + 2] = data[i]; | ~~~^~~ applications\external\canbus\libraries\mcp_can_2515.c: In function 'write_mf': applications\external\canbus\libraries\mcp_can_2515.c:29:13: note: APPMETA build\f7-firmware-C.extapps\esp32_camera.fap while referencing ' FAP build\f7-firmware-C.extapps\esp32_camera.fap instruction' 29 | uint8_t instruction[] = {INSTRUCTION_WRITE, address}; | ^~~ In function 'set_registerS', inlined from 'write_mf CC build\f7-firmware-C.extapps\camera_suite\camera_suite_icons.c ' at applications\external\canbus\libraries\mcp_can_2515.c:96:5: applications\external\canbus\libraries\mcp_can_2515.c:33:28: error: '__builtin_memcpy' offset [2, 5] is out of the bounds [0, 2] of object 'instruction' with type 'uint8_t[2]' {aka 'unsigned char[2]'} [-Werror=array-bounds] 33 | instruction[i + 2] = data[i]; | ~~~~~^~~ applications\external\canbus\libraries\mcp_can_2515.c: In function 'write_mf': applications\external\canbus\libraries\mcp_can_2515.c:29:13: note: 'instruction' declared here 29 | uint8_t instruction[] = {INSTRUCTION_WRITE, address}; | ^~~ APPMETA build\f7-firmware-C.extapps\can_commander.fap

RogueMaster commented 1 month ago

Thank you, it is fixed and I added this one to my firmware 😄