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

Add OSX riscv64 toolchain installation instructions #83

Closed
brainstorm opened this issue Jan 29, 2023 · 8 comments
Closed

Add OSX riscv64 toolchain installation instructions #83

brainstorm opened this issue Jan 29, 2023 · 8 comments

Comments

@brainstorm
Copy link

See: riscv-collab/riscv-gnu-toolchain#800 (comment)

Although it doesn't work out of the box (yet) since it needs some tweaking on the CMake files since some features of my M0S Dock are not working:

helloworld % make CHIP=bl616 BOARD=bl616dk
./../../tools/cmake/bin/cmake -S . -B build -G "Unix Makefiles" -DCROSS_COMPILE=riscv64-unknown-elf- -DCHIP=bl616 -DCPU_ID= -DBOARD=bl616dk -DBOARD_DIR= -DCONFIG_DEBUG=y -DCONFIG_ROMAPI=y -DCONFIG_USB_HS=y -DCONFIG_COMX=COM5 -DCMAKE_EXPORT_COMPILE_COMMANDS=OFF -DCONFIG_TLSF=y
-- [register library : libc], path:/Users/rvalls/dev/personal/bl_mcu_sdk/components/libc
-- [register library : mm], path:/Users/rvalls/dev/personal/bl_mcu_sdk/components/mm
-- [register library : utils], path:/Users/rvalls/dev/personal/bl_mcu_sdk/components/utils
-- [register library : lhal], path:/Users/rvalls/dev/personal/bl_mcu_sdk/drivers/lhal
-- [register extern library : libpka], path:/Users/rvalls/dev/personal/bl_mcu_sdk/drivers/lhal
-- [register library : std], path:/Users/rvalls/dev/personal/bl_mcu_sdk/drivers/soc/bl616/std
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/rvalls/dev/personal/bl_mcu_sdk/examples/helloworld/build
cd build && make -j8
Consolidate compiler generated dependencies of target app
Scanning dependencies of target std
[  2%] Building C object build_out/components/mm/CMakeFiles/mm.dir/mem.c.obj
[  2%] Building C object build_out/components/utils/CMakeFiles/utils.dir/bflb_block_pool/bflb_block_pool.c.obj
[  3%] Building C object build_out/components/utils/CMakeFiles/utils.dir/ring_buffer/ring_buffer.c.obj
[  4%] Building ASM object build_out/drivers/soc/bl616/std/CMakeFiles/std.dir/startup/start.S.obj
[  5%] Building C object build_out/components/utils/CMakeFiles/utils.dir/log/log.c.obj
[  5%] Building C object CMakeFiles/app.dir/Users/rvalls/dev/personal/bl_mcu_sdk/bsp/board/bl616dk/board.c.obj
[  6%] Building C object build_out/components/libc/CMakeFiles/libc.dir/nuttx/libc/stdlib/lib_abs.c.obj
[  7%] Building C object build_out/drivers/lhal/CMakeFiles/lhal.dir/src/bflb_common.c.obj
cc1: error: unknown cpu 'e907' for '-mtune'
cc1: error: unknown cpu 'e907' for '-mtune'
cc1: error: unknown cpu 'e907' for '-mtune'
cc1: error: unknown cpu 'e907' for '-mtune'
cc1: error: unknown cpu 'e907' for '-mtune'
cc1: error: unknown cpu 'e907' for '-mtune'
cc1: error: unknown cpu 'e907' for '-mtune'
cc1: error: unknown cpu 'e907' for '-mtune'
make[3]: *** [CMakeFiles/app.dir/Users/rvalls/dev/personal/bl_mcu_sdk/bsp/board/bl616dk/board.c.obj] Error 1
make[3]: *** [build_out/components/utils/CMakeFiles/utils.dir/bflb_block_pool/bflb_block_pool.c.obj] Error 1
make[3]: *** Waiting for unfinished jobs....
make[3]: *** [build_out/components/mm/CMakeFiles/mm.dir/mem.c.obj] Error 1
make[3]: *** [build_out/components/utils/CMakeFiles/utils.dir/log/log.c.obj] Error 1make[3]: *** [build_out/components/libc/CMakeFiles/libc.dir/nuttx/libc/stdlib/lib_abs.c.obj] Error 1
make[2]: *** [CMakeFiles/app.dir/all] Error 2
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [build_out/components/mm/CMakeFiles/mm.dir/all] Error 2

make[3]: *** [build_out/drivers/lhal/CMakeFiles/lhal.dir/src/bflb_common.c.obj] Error 1
make[3]: *** [build_out/components/utils/CMakeFiles/utils.dir/ring_buffer/ring_buffer.c.obj] Error 1
make[2]: *** [build_out/drivers/lhal/CMakeFiles/lhal.dir/all] Error 2
make[2]: *** [build_out/components/utils/CMakeFiles/utils.dir/all] Error 2
make[3]: *** [build_out/drivers/soc/bl616/std/CMakeFiles/std.dir/startup/start.S.obj] Error 1
make[3]: *** Waiting for unfinished jobs....
make[2]: *** [build_out/components/libc/CMakeFiles/libc.dir/all] Error 2
[  8%] Building ASM object build_out/drivers/soc/bl616/std/CMakeFiles/std.dir/startup/vector.S.obj
cc1: error: unknown cpu 'e907' for '-mtune'
make[3]: *** [build_out/drivers/soc/bl616/std/CMakeFiles/std.dir/startup/vector.S.obj] Error 1
make[2]: *** [build_out/drivers/soc/bl616/std/CMakeFiles/std.dir/all] Error 2
make[1]: *** [all] Error 2
make: *** [build] Error 2
@sakumisu
Copy link

Must use our toolchain in readme

@sakumisu
Copy link

Your toolchain is not match with our chip.

@gamelaster
Copy link
Contributor

Follow this: https://github.com/p4ddy1/pine_ox64/blob/main/build_toolchain_macos.md

@acemtp
Copy link

acemtp commented Feb 5, 2023

@gamelaster I followed your really cool doc, everything compiles but it stalled for 10mn (linking?) and then exit like this

/bin/sh ../.././riscv-gcc/gcc/../move-if-change tmp-mlib.h multilib.h
echo timestamp > s-mlib
rm gcov.pod fsf-funding.pod lto-dump.pod gpl.pod cpp.pod gfdl.pod gcc.pod gcov-dump.pod gcov-tool.pod
make[1]: *** [all-gcc] Error 2
make: *** [stamps/build-gcc-newlib-stage1] Error 2

I don't see anywhere I can find the error

@acemtp
Copy link

acemtp commented Feb 6, 2023

Ok, it was my fault, i missed the following line:

export PATH=$(brew --prefix)/opt/coreutils/libexec/gnubin:$PATH

Now it compiled!

@acemtp
Copy link

acemtp commented Feb 6, 2023

Ok, I compiled the toolchain, now when I compile the gpio example, got this error during the link, no idea at all on what's wrong. It worked on linux but not on mac

❯ make
cmake -S . -B build -G "Unix Makefiles" -DCROSS_COMPILE=riscv64-unknown-elf- -DCHIP=bl616 -DCPU_ID= -DBOARD=bl616dk -DBOARD_DIR= -DCONFIG_DEBUG=y -DCONFIG_ROMAPI=y -DCONFIG_USB_HS=y -DCONFIG_COMX=COM5 -DCMAKE_EXPORT_COMPILE_COMMANDS=OFF -DCONFIG_TLSF=y
-- [register library : libc], path:/Users/vialec75/tmp/bl_mcu_sdk/components/libc
-- [register library : mm], path:/Users/vialec75/tmp/bl_mcu_sdk/components/mm
-- [register library : utils], path:/Users/vialec75/tmp/bl_mcu_sdk/components/utils
-- [register library : lhal], path:/Users/vialec75/tmp/bl_mcu_sdk/drivers/lhal
-- [register extern library : libpka], path:/Users/vialec75/tmp/bl_mcu_sdk/drivers/lhal
-- [register library : std], path:/Users/vialec75/tmp/bl_mcu_sdk/drivers/soc/bl616/std
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/vialec75/tmp/bl_mcu_sdk/examples/peripherals/gpio/gpio_input_output/build
cd build && make -j8
[  2%] Built target app
[  4%] Built target mm
[ 11%] Built target utils
[ 40%] Built target std
[ 94%] Built target libc
[ 98%] Built target lhal
[ 99%] Linking C executable build_out/gpio_input_output_bl616.elf
riscv64-unknown-elf-gcc: fatal error: cannot read spec file 'nano.specs': No such file or directory
compilation terminated.
make[3]: *** [build_out/gpio_input_output_bl616.elf] Error 1
make[2]: *** [CMakeFiles/gpio_input_output_bl616.elf.dir/all] Error 2
make[1]: *** [all] Error 2
make: *** [build] Error 2

@brainstorm
Copy link
Author

Compiled the toolchain and the helloworld example successfully... BUT:

% make flash CHIP=bl616 COMX=/dev/tty.usbmodem1102
Support in next version, please use devcube now

So what's devcube exactly? A hardware probe? A windows program? Is there something equivalent for OSX?

@Fishwaldo
Copy link
Contributor

You have to flash with BLDevCube

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants