arduino/arduino-renesas-bootloader

File not found for compilation

simooon442 opened this issue · 11 comments

Error when trying to compile makeFile.minima. After looking at everywhere, I didn't find these files. Where do we have to find them ?
Otherwise, do you have a tutorial for making a bootloader with the file you shared to community ?
Thanks.

LINK _build/uno_r4/arduino-renesas-bootloader-main.elf
arm-none-eabi-gcc: error: _build/uno_r4/obj/hw/mcu/renesas/fsp/ra/fsp/src/bsp/cmsis/Device/RENESAS/Source/startup.o: No such file or directory
arm-none-eabi-gcc: error: _build/uno_r4/obj/hw/mcu/renesas/fsp/ra/fsp/src/bsp/cmsis/Device/RENESAS/Source/system.o: No such file or directory
arm-none-eabi-gcc: error: _build/uno_r4/obj/hw/mcu/renesas/fsp/ra/fsp/src/bsp/mcu/all/bsp_clocks.o: No such file or directory
arm-none-eabi-gcc: error: _build/uno_r4/obj/hw/mcu/renesas/fsp/ra/fsp/src/bsp/mcu/all/bsp_common.o: No such file or directory
arm-none-eabi-gcc: error: _build/uno_r4/obj/hw/mcu/renesas/fsp/ra/fsp/src/bsp/mcu/all/bsp_delay.o: No such file or directory
arm-none-eabi-gcc: error: _build/uno_r4/obj/hw/mcu/renesas/fsp/ra/fsp/src/bsp/mcu/all/bsp_group_irq.o: No such file or directory
arm-none-eabi-gcc: error: _build/uno_r4/obj/hw/mcu/renesas/fsp/ra/fsp/src/bsp/mcu/all/bsp_guard.o: No such file or directory
arm-none-eabi-gcc: error: _build/uno_r4/obj/hw/mcu/renesas/fsp/ra/fsp/src/bsp/mcu/all/bsp_io.o: No such file or directory
arm-none-eabi-gcc: error: _build/uno_r4/obj/hw/mcu/renesas/fsp/ra/fsp/src/bsp/mcu/all/bsp_irq.o: No such file or directory
arm-none-eabi-gcc: error: _build/uno_r4/obj/hw/mcu/renesas/fsp/ra/fsp/src/bsp/mcu/all/bsp_register_protection.o: No such file or directory
arm-none-eabi-gcc: error: _build/uno_r4/obj/hw/mcu/renesas/fsp/ra/fsp/src/bsp/mcu/all/bsp_rom_registers.o: No such file or directory
arm-none-eabi-gcc: error: _build/uno_r4/obj/hw/mcu/renesas/fsp/ra/fsp/src/bsp/mcu/all/bsp_sbrk.o: No such file or directory
arm-none-eabi-gcc: error: _build/uno_r4/obj/hw/mcu/renesas/fsp/ra/fsp/src/bsp/mcu/all/bsp_security.o: No such file or directory
arm-none-eabi-gcc: error: _build/uno_r4/obj/hw/mcu/renesas/fsp/ra/fsp/src/r_ioport/r_ioport.o: No such file or directory
arm-none-eabi-gcc: error: _build/uno_r4/obj//Users/PC/Downloads/arduino-renesas-bootloader-main/tinyusb/hw/mcu/renesas/fsp/ra/fsp/src/r_flash_lp/r_flash_lp.o: No such file or directory```

I think you missed to run this line from inside the tinyusb root directory python tools/get_deps.py ra .
Let me know if it works!

I tried it, but get an error each time

MacBook-Pro:tinyusb simoon$ python tools/get_deps.py ra
  File "tools/get_deps.py", line 187
    deps_all = {**deps_mandatory, **deps_optional}
                 ^
SyntaxError: invalid syntax
MacBook-Pro:tinyusb simoon$ ```

Can you retry with python3 ?

Yes, python3 works, but, I get this first error now :

MacBook-Pro:arduino-renesas-bootloader simoon$ TINYUSB_ROOT=$PWD/../tinyusb make -f Makefile.minima
Makefile.minima:8: /Users/simoon/Downloads/bootloader/arduino-renesas-bootloader/../tinyusb/examples/make.mk: No such file or directory
Makefile.minima:32: /Users/simoon/Downloads/bootloader/arduino-renesas-bootloader/../tinyusb/examples/rules.mk: No such file or directory
make: *** No rule to make target `/Users/simoon/Downloads/bootloader/arduino-renesas-bootloader/../tinyusb/examples/rules.mk'.  Stop.
MacBook-Pro:arduino-renesas-bootloader simoon$ 

So after copy/paste required folder at the right place, I get this error

MacBook-Pro:arduino-renesas-bootloader simoon$ TINYUSB_ROOT=$PWD/../tinyusb make -f Makefile.minima
You must provide a BOARD parameter with 'BOARD='
/Users/simoon/Downloads/bootloader/arduino-renesas-bootloader/../tinyusb/examples/make.mk:60: *** Invalid BOARD specified.  Stop.
MacBook-Pro:arduino-renesas-bootloader simoon$ 

Can you retry with python3 ?

After investigation, It seems, instruction which are written here https://github.com/arduino/ArduinoCore-renesas/blob/main/bootloaders/UNO_R4/README.md?plain=1 is not up to date, because tinyusb folder structure (and maybe files) has changed compared to older version like 0.15 or 0.14 which I presume instruction was made for.

So, do you have a solution for making bootloader which take into account the update of tinyusb ?

Hello @facchinm
To take news, is there a solution or another way to solve this problem ?

Thank you for your feedback.

I finally had some time to check the tinyusb changes and indeed they are moving to cmake, so the makefile in this reos should be modified like this

diff --git a/Makefile.minima b/Makefile.minima
index 4050654..b192af2 100644
--- a/Makefile.minima
+++ b/Makefile.minima
@@ -5,7 +5,7 @@ BOARD ?= uno_r4
 # python tools/get_deps.py ra
 # once in the tinyusb root folder
 
-include $(TOP)/examples/make.mk
+include $(TOP)/examples/build_system/make/make.mk
 
 INC += \
        src \
@@ -29,6 +29,6 @@ LDFLAGS += -Wl,--gc-sections -flto
 
 CFLAGS += --warn-no-undef
 
-include $(TOP)/examples/rules.mk
+include $(TOP)/examples/build_system/make/rules.mk
 

After changing these lines it compiles just fine on my setup (Linux). Didn't try in other OS though

I finally had some time to check the tinyusb changes and indeed they are moving to cmake, so the makefile in this reos should be modified like this

diff --git a/Makefile.minima b/Makefile.minima
index 4050654..b192af2 100644
--- a/Makefile.minima
+++ b/Makefile.minima
@@ -5,7 +5,7 @@ BOARD ?= uno_r4
 # python tools/get_deps.py ra
 # once in the tinyusb root folder
 
-include $(TOP)/examples/make.mk
+include $(TOP)/examples/build_system/make/make.mk
 
 INC += \
        src \
@@ -29,6 +29,6 @@ LDFLAGS += -Wl,--gc-sections -flto
 
 CFLAGS += --warn-no-undef
 
-include $(TOP)/examples/rules.mk
+include $(TOP)/examples/build_system/make/rules.mk
 

After changing these lines it compiles just fine on my setup (Linux). Didn't try in other OS though

Thank you very much for this ! And thank you for taking the time to look at this problem.

So I've just test it on mac MacOS, then I get one more error :

MacBook-Pro:arduino-renesas-bootloader$ TINYUSB_ROOT=$PWD/../tinyusb make -f Makefile.minima
Makefile.minima:1: *** missing separator.  Stop.

I replace the entire content of the Makefile.minima with the code you write above.

Is there something I missed ?

I installed CMAKE tool, but I'm unable to make it works.
Can you please give me steps to use it for making the bootloader ?

I finally had some time to check the tinyusb changes and indeed they are moving to cmake, so the makefile in this reos should be modified like this

diff --git a/Makefile.minima b/Makefile.minima
index 4050654..b192af2 100644
--- a/Makefile.minima
+++ b/Makefile.minima
@@ -5,7 +5,7 @@ BOARD ?= uno_r4

python tools/get_deps.py ra

once in the tinyusb root folder

-include $(TOP)/examples/make.mk
+include $(TOP)/examples/build_system/make/make.mk

INC +=
src
@@ -29,6 +29,6 @@ LDFLAGS += -Wl,--gc-sections -flto

CFLAGS += --warn-no-undef

-include $(TOP)/examples/rules.mk
+include $(TOP)/examples/build_system/make/rules.mk

After changing these lines it compiles just fine on my setup (Linux). Didn't try in other OS though

So which file has to be modified and are the red lines lines to be replaced by the green ones? I'm a bit confused. Trying to create a bootloader for the Arduino Minima that doesn't flash pin 13 when booting. It is connected to a custom PCB and I stupidly connected an SSR that switches a rather large fan in my project so every time I change a line of code my fan starts blowing three times...

If anybody could supply me a non blinking dfu_minima.hex file (maybe as simple as commenting line 444 in main.c) that would be a solution as well :)

I added the complete instructions in the Readme, should work just fine (at least on Linux 🙂 ). Closing the issue, please reopen if problems persist.

I followed the steps in the readme carefully, including the patch using python3. I tried to compile on both RPi and MacOS. The first issue I encountered was gcc-arm-none-eabi was not available so I tried
arm-none-eabi-gcc. Lost here a bit. Thanks for your patience

RPi error:
TINYUSB_ROOT=$PWD/../tinyusb make -f Makefile.minima
CC dcd_rusb2.o
arm-none-eabi-gcc: error: unrecognized command line option '-Wcast-function-type'; did you mean '-Wbad-function-cast'?
make: *** [/home/minima/tinyusb/examples/build_system/make/toolchain/gcc_rules.mk:54: _build/uno_r4/obj/src/portable/renesas/rusb2/dcd_rusb2.o] Fout 1

MacOS error:
TINYUSB_ROOT=$PWD/../tinyusb make -f Makefile.minima
CC dcd_rusb2.o
In file included from */minima/tinyusb/src/device/dcd.h:30,
from */minima/tinyusb/src/portable/renesas/rusb2/dcd_rusb2.c:32:
*/minima/tinyusb/src/common/tusb_common.h:68:10: fatal error: inttypes.h: No such file or directory
68 | #include <inttypes.h>
| ^~~~~~~~~~~~
compilation terminated.
make: *** [_build/uno_r4/obj/src/portable/renesas/rusb2/dcd_rusb2.o] Error 1