Skip to content
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

Core code should compile without warnings. #77

Open
KurtE opened this issue Aug 1, 2023 · 2 comments · May be fixed by #96
Open

Core code should compile without warnings. #77

KurtE opened this issue Aug 1, 2023 · 2 comments · May be fixed by #96
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@KurtE
Copy link
Contributor

KurtE commented Aug 1, 2023

As I mentioned on the memory corruption issue, as a general practice, I don't want to see any compiler warnings, in my builds, even with the full or all warnings option turned on. Often times Warnings give you a hint on what might be wrong.

But your mind gets unsensitized to it, when you see them with every build. So you might miss ones that actually might help localize an issue.

With the current board release, I see warnings in at least two of the source files:

"C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" -c -Wall -Wextra -Os -g3 -fno-use-cxa-atexit -fno-rtti -fno-exceptions -MMD -nostdlib -DF_CPU=48000000 -DNO_USB -DBACKTRACE_SUPPORT -DARDUINO_UNOR4_WIFI -MMD -std=gnu++17 -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsigned-char -ffunction-sections -fdata-sections -fmessage-length=0 -fno-builtin -DARDUINO=10607 "-DPROJECT_NAME=\"C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino\\sketches\\BD525D585FBF6679F28F92809D7A82B2/string_memory_corrupt.ino\"" -DARDUINO_UNOWIFIR4 -DARDUINO_ARCH_RENESAS_UNO -DARDUINO_ARCH_RENESAS -DARDUINO_FSP -D_XOPEN_SOURCE -mthumb "@C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\UNOWIFIR4/defines.txt" -DCFG_TUSB_MCU=OPT_MCU_RAXXX "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2/cores/arduino/tinyusb" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino/api/deprecated" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino/api/deprecated-avr-comp" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\UNOWIFIR4" "-iprefixC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2" "@C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\UNOWIFIR4/includes.txt" "C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino\\time.cpp" -o "C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino\\sketches\\BD525D585FBF6679F28F92809D7A82B2\\core\\time.cpp.o"
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.0.2\cores\arduino\cm_backtrace\cm_backtrace.c: In function 'cm_backtrace_init':
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.0.2\cores\arduino\cm_backtrace\cm_backtrace.c:144:13: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     fw_name = firmware_name;
             ^
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.0.2\cores\arduino\cm_backtrace\cm_backtrace.c:145:12: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     hw_ver = hardware_ver;
            ^
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.0.2\cores\arduino\cm_backtrace\cm_backtrace.c:146:12: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     sw_ver = software_ver;

And:

"C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" -c -Wall -Wextra -Os -g3 -fno-use-cxa-atexit -fno-rtti -fno-exceptions -MMD -nostdlib -DF_CPU=48000000 -DNO_USB -DBACKTRACE_SUPPORT -DARDUINO_UNOR4_WIFI -MMD -std=gnu++17 -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsigned-char -ffunction-sections -fdata-sections -fmessage-length=0 -fno-builtin -DARDUINO=10607 "-DPROJECT_NAME=\"C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino\\sketches\\BD525D585FBF6679F28F92809D7A82B2/string_memory_corrupt.ino\"" -DARDUINO_UNOWIFIR4 -DARDUINO_ARCH_RENESAS_UNO -DARDUINO_ARCH_RENESAS -DARDUINO_FSP -D_XOPEN_SOURCE -mthumb "@C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\UNOWIFIR4/defines.txt" -DCFG_TUSB_MCU=OPT_MCU_RAXXX "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2/cores/arduino/tinyusb" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino/api/deprecated" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino/api/deprecated-avr-comp" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\UNOWIFIR4" "-iprefixC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2" "@C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\UNOWIFIR4/includes.txt" "C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino\\usb\\USB.cpp" -o "C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino\\sketches\\BD525D585FBF6679F28F92809D7A82B2\\core\\usb\\USB.cpp.o"
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.0.2\cores\arduino\IRQManager.cpp: In member function 'bool IRQManager::addPeripheral(Peripheral_t, void*)':
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.0.2\cores\arduino\IRQManager.cpp:345:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if (irqcfg->first_irq_number != FSP_INVALID_VECTOR) {
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.0.2\cores\arduino\IRQManager.cpp:408:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if (irqcfg->first_irq_number != FSP_INVALID_VECTOR) {
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.0.2\cores\arduino\IRQManager.cpp: In member function 'void IRQManager::set_canfd_error_link_event(int, int)':
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.0.2\cores\arduino\IRQManager.cpp:1662:49: warning: unused parameter 'li' [-Wunused-parameter]
 void IRQManager::set_canfd_error_link_event(int li, int ch)
                                                 ^~
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.0.2\cores\arduino\IRQManager.cpp:1662:57: warning: unused parameter 'ch' [-Wunused-parameter]
 void IRQManager::set_canfd_error_link_event(int li, int ch)
                                                         ^~
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.0.2\cores\arduino\IRQManager.cpp: In member function 'void IRQManager::set_canfd_rx_link_event(int, int)':
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.0.2\cores\arduino\IRQManager.cpp:1677:46: warning: unused parameter 'li' [-Wunused-parameter]
 void IRQManager::set_canfd_rx_link_event(int li, int ch)
                                              ^~
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.0.2\cores\arduino\IRQManager.cpp:1677:54: warning: unused parameter 'ch' [-Wunused-parameter]
 void IRQManager::set_canfd_rx_link_event(int li, int ch)
                                                      ^~
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.0.2\cores\arduino\IRQManager.cpp: In member function 'void IRQManager::set_canfd_tx_link_event(int, int)':
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.0.2\cores\arduino\IRQManager.cpp:1692:46: warning: unused parameter 'li' [-Wunused-parameter]
 void IRQManager::set_canfd_tx_link_event(int li, int ch)
                                              ^~
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.0.2\cores\arduino\IRQManager.cpp:1692:54: warning: unused parameter 'ch' [-Wunused-parameter]
 void IRQManager::set_canfd_tx_link_event(int li, int ch)
                                                      ^~

My quick look through I don't see anything obvious that is impacting the memory corruption bug, but...

@facchinm
Copy link
Member

facchinm commented Aug 4, 2023

Hi @KurtE ,
I agree on the general topic (I also compile with -Wall all the time and try to be as warning-free as possible).
The one on cm_backtrace.c should be easily fixable, while the one related to CAN in IRQManager.cpp is very hard to get right (we need to keep that file generic but there's no define provided by fsp to recognize if the CAN peripheral is CAN or CANFD.
Feel free to provide a patch on the easy ones, I'll be glad to merge it 🙂

@KurtE
Copy link
Contributor Author

KurtE commented Aug 7, 2023

I pushed some of the changes needed as part of my Draft PR #90
Probably should be their own.

There were a few warrnings, where signed versus unsigned as some of the values were defined as - numbers to a type and compared to a variable that is uint32_t. Plus did attempt to get to the printf one where %X and variable passed was signed.

@per1234 per1234 added type: imperfection Perceived defect in any part of project topic: code Related to content of the project itself labels Aug 8, 2023
pennam pushed a commit to pennam/ArduinoCore-renesas that referenced this issue Aug 9, 2023
Adapt to changed function signatures in TinyUSB
KurtE added a commit to KurtE/ArduinoCore-renesas that referenced this issue Aug 11, 2023
Resolves arduino#77

At least partially.  I did not go into the API class to fix the printf statement issue.
@KurtE KurtE linked a pull request Aug 11, 2023 that will close this issue
cristidragomir97 pushed a commit to cristidragomir97/ArduinoCore-renesas that referenced this issue May 20, 2024
Adapt to changed function signatures in TinyUSB

Former-commit-id: 5ef8470
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants