From bb03b7eb1032c50d91f6284e545bdd463e5e37f9 Mon Sep 17 00:00:00 2001 From: Bunnaroath Sou Date: Mon, 29 Apr 2019 09:23:45 -0700 Subject: Add LEDs for HiFive1 boards --- bsp/sifive-hifive1-revb/design.dts | 18 ++++++++++++++++++ bsp/sifive-hifive1/design.dts | 18 ++++++++++++++++++ bsp/update-targets.sh | 6 +++++- 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/bsp/sifive-hifive1-revb/design.dts b/bsp/sifive-hifive1-revb/design.dts index 6c7da04..0e48622 100644 --- a/bsp/sifive-hifive1-revb/design.dts +++ b/bsp/sifive-hifive1-revb/design.dts @@ -192,5 +192,23 @@ reg = <0x10016000 0x1000>; reg-names = "control"; }; + led@0red { + compatible = "sifive,gpio-leds"; + label = "LD0red"; + gpios = <&gpio0 22>; + linux,default-trigger = "none"; + }; + led@0green { + compatible = "sifive,gpio-leds"; + label = "LD0green"; + gpios = <&gpio0 19>; + linux,default-trigger = "none"; + }; + led@0blue { + compatible = "sifive,gpio-leds"; + label = "LD0blue"; + gpios = <&gpio0 21>; + linux,default-trigger = "none"; + }; }; }; diff --git a/bsp/sifive-hifive1/design.dts b/bsp/sifive-hifive1/design.dts index 5ddee6f..d633f10 100644 --- a/bsp/sifive-hifive1/design.dts +++ b/bsp/sifive-hifive1/design.dts @@ -180,5 +180,23 @@ clocks = <&hfclk>; pinmux = <&gpio0 0x0003C 0x0003C>; }; + led@0red { + compatible = "sifive,gpio-leds"; + label = "LD0red"; + gpios = <&gpio0 22>; + linux,default-trigger = "none"; + }; + led@0green { + compatible = "sifive,gpio-leds"; + label = "LD0green"; + gpios = <&gpio0 19>; + linux,default-trigger = "none"; + }; + led@0blue { + compatible = "sifive,gpio-leds"; + label = "LD0blue"; + gpios = <&gpio0 21>; + linux,default-trigger = "none"; + }; }; }; diff --git a/bsp/update-targets.sh b/bsp/update-targets.sh index 0ae3ff4..c659f7d 100755 --- a/bsp/update-targets.sh +++ b/bsp/update-targets.sh @@ -80,13 +80,16 @@ SETTINGS_FILENAME=settings.mk update_target() { TARGET=$1 + if [ "$TARGET_TYPE" == "" ]; then + TARGET_TYPE=$TARGET + fi echo "Updating target $TARGET" if [ $NO_FIXUP != 1 ]; then ../scripts/fixup-dts --dts $TARGET/$DTS_FILENAME || die "Failed to check $TARGET/$DTS_FILENAME for missing elements" fi - + # Compile temporary .dtb $DTC -I dts -O dtb -o $TARGET/$DTB_FILENAME $TARGET/$DTS_FILENAME || die "Failed to compile $TARGET/$DTS_FILENAME to dtb" @@ -100,6 +103,7 @@ update_target() { # Remove temporary .dtb rm $TARGET/$DTB_FILENAME + TARGET_TYPE="" echo "" } -- cgit v1.2.3 From 1741292e512bc0659f7c7434ff056c7426758a4c Mon Sep 17 00:00:00 2001 From: Bunnaroath Sou Date: Mon, 29 Apr 2019 11:02:31 -0700 Subject: Update Dhrystone and metal to remove nano & pick memory.h --- software/dhrystone | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/software/dhrystone b/software/dhrystone index 1472b50..70d0c0e 160000 --- a/software/dhrystone +++ b/software/dhrystone @@ -1 +1 @@ -Subproject commit 1472b5092fa52551670908aa15d48eb974ccd453 +Subproject commit 70d0c0e68ae6a6e7eb1d3083b93849ecc9bde16e -- cgit v1.2.3 From 3448fa201b9be5a201fc7496476999975948766a Mon Sep 17 00:00:00 2001 From: Bunnaroath Sou Date: Mon, 29 Apr 2019 11:08:01 -0700 Subject: Update metal.*, *.dts and settings to latest --- bsp/coreip-e20-arty/settings.mk | 2 +- bsp/coreip-e31-arty/settings.mk | 2 +- bsp/coreip-e31-rtl/settings.mk | 2 +- bsp/coreip-e34-arty/settings.mk | 2 +- bsp/coreip-e34-rtl/settings.mk | 2 +- bsp/sifive-hifive1-revb/metal.h | 50 +++++++++++++++++++++++++++++++++++++++-- bsp/sifive-hifive1/metal.h | 50 +++++++++++++++++++++++++++++++++++++++-- 7 files changed, 101 insertions(+), 9 deletions(-) diff --git a/bsp/coreip-e20-arty/settings.mk b/bsp/coreip-e20-arty/settings.mk index 0b9c2cb..c28ec0c 100644 --- a/bsp/coreip-e20-arty/settings.mk +++ b/bsp/coreip-e20-arty/settings.mk @@ -1,4 +1,4 @@ -RISCV_ARCH=rv32imac +RISCV_ARCH=rv32imc RISCV_ABI=ilp32 RISCV_CMODEL=medlow diff --git a/bsp/coreip-e31-arty/settings.mk b/bsp/coreip-e31-arty/settings.mk index c2a2547..0b9c2cb 100644 --- a/bsp/coreip-e31-arty/settings.mk +++ b/bsp/coreip-e31-arty/settings.mk @@ -1,5 +1,5 @@ RISCV_ARCH=rv32imac RISCV_ABI=ilp32 -RISCV_CMODEL=medany +RISCV_CMODEL=medlow TARGET_TAGS=fpga openocd diff --git a/bsp/coreip-e31-rtl/settings.mk b/bsp/coreip-e31-rtl/settings.mk index 50ec3c7..f60f250 100644 --- a/bsp/coreip-e31-rtl/settings.mk +++ b/bsp/coreip-e31-rtl/settings.mk @@ -1,6 +1,6 @@ RISCV_ARCH=rv32imac RISCV_ABI=ilp32 -RISCV_CMODEL=medany +RISCV_CMODEL=medlow COREIP_MEM_WIDTH=32 diff --git a/bsp/coreip-e34-arty/settings.mk b/bsp/coreip-e34-arty/settings.mk index 249d7e0..62d3775 100644 --- a/bsp/coreip-e34-arty/settings.mk +++ b/bsp/coreip-e34-arty/settings.mk @@ -1,5 +1,5 @@ RISCV_ARCH=rv32imafc RISCV_ABI=ilp32f -RISCV_CMODEL=medany +RISCV_CMODEL=medlow TARGET_TAGS=fpga openocd diff --git a/bsp/coreip-e34-rtl/settings.mk b/bsp/coreip-e34-rtl/settings.mk index 93a732a..880c000 100644 --- a/bsp/coreip-e34-rtl/settings.mk +++ b/bsp/coreip-e34-rtl/settings.mk @@ -1,6 +1,6 @@ RISCV_ARCH=rv32imafc RISCV_ABI=ilp32f -RISCV_CMODEL=medany +RISCV_CMODEL=medlow COREIP_MEM_WIDTH=32 diff --git a/bsp/sifive-hifive1-revb/metal.h b/bsp/sifive-hifive1-revb/metal.h index a5d90e5..82bfd01 100644 --- a/bsp/sifive-hifive1-revb/metal.h +++ b/bsp/sifive-hifive1-revb/metal.h @@ -66,6 +66,7 @@ #include #include #include +#include #include #include #include @@ -117,6 +118,18 @@ struct __metal_driver_sifive_local_external_interrupts0 __metal_dt_local_externa asm (".weak __metal_dt_gpio_10012000"); struct __metal_driver_sifive_gpio0 __metal_dt_gpio_10012000; +/* From led@0red */ +asm (".weak __metal_dt_led_0red"); +struct __metal_driver_sifive_gpio_led __metal_dt_led_0red; + +/* From led@0green */ +asm (".weak __metal_dt_led_0green"); +struct __metal_driver_sifive_gpio_led __metal_dt_led_0green; + +/* From led@0blue */ +asm (".weak __metal_dt_led_0blue"); +struct __metal_driver_sifive_gpio_led __metal_dt_led_0blue; + /* From spi@10014000 */ asm (".weak __metal_dt_spi_10014000"); struct __metal_driver_sifive_spi0 __metal_dt_spi_10014000; @@ -286,6 +299,36 @@ struct __metal_driver_sifive_gpio0 __metal_dt_gpio_10012000 = { .interrupt_lines[15] = 22, }; +/* From led@0red */ +struct __metal_driver_sifive_gpio_led __metal_dt_led_0red = { + .vtable = &__metal_driver_vtable_sifive_led, + .led.vtable = &__metal_driver_vtable_sifive_led.led_vtable, +/* From gpio@10012000 */ + .gpio = &__metal_dt_gpio_10012000, + .pin = 22UL, + .label = "LD0red", +}; + +/* From led@0green */ +struct __metal_driver_sifive_gpio_led __metal_dt_led_0green = { + .vtable = &__metal_driver_vtable_sifive_led, + .led.vtable = &__metal_driver_vtable_sifive_led.led_vtable, +/* From gpio@10012000 */ + .gpio = &__metal_dt_gpio_10012000, + .pin = 19UL, + .label = "LD0green", +}; + +/* From led@0blue */ +struct __metal_driver_sifive_gpio_led __metal_dt_led_0blue = { + .vtable = &__metal_driver_vtable_sifive_led, + .led.vtable = &__metal_driver_vtable_sifive_led.led_vtable, +/* From gpio@10012000 */ + .gpio = &__metal_dt_gpio_10012000, + .pin = 21UL, + .label = "LD0blue", +}; + /* From spi@10014000 */ struct __metal_driver_sifive_spi0 __metal_dt_spi_10014000 = { .vtable = &__metal_driver_vtable_sifive_spi0, @@ -414,11 +457,14 @@ struct __metal_driver_sifive_gpio0 *__metal_gpio_table[] = { asm (".weak __metal_button_table"); struct __metal_driver_sifive_gpio_button *__metal_button_table[] = { NULL }; -#define __METAL_DT_MAX_LEDS 0 +#define __METAL_DT_MAX_LEDS 3 asm (".weak __metal_led_table"); struct __metal_driver_sifive_gpio_led *__metal_led_table[] = { - NULL }; + &__metal_dt_led_0red, + &__metal_dt_led_0green, + &__metal_dt_led_0blue}; + #define __METAL_DT_MAX_SWITCHES 0 asm (".weak __metal_switch_table"); diff --git a/bsp/sifive-hifive1/metal.h b/bsp/sifive-hifive1/metal.h index 422bdf1..28979c7 100644 --- a/bsp/sifive-hifive1/metal.h +++ b/bsp/sifive-hifive1/metal.h @@ -66,6 +66,7 @@ #include #include #include +#include #include #include #include @@ -114,6 +115,18 @@ struct __metal_driver_sifive_local_external_interrupts0 __metal_dt_local_externa asm (".weak __metal_dt_gpio_10012000"); struct __metal_driver_sifive_gpio0 __metal_dt_gpio_10012000; +/* From led@0red */ +asm (".weak __metal_dt_led_0red"); +struct __metal_driver_sifive_gpio_led __metal_dt_led_0red; + +/* From led@0green */ +asm (".weak __metal_dt_led_0green"); +struct __metal_driver_sifive_gpio_led __metal_dt_led_0green; + +/* From led@0blue */ +asm (".weak __metal_dt_led_0blue"); +struct __metal_driver_sifive_gpio_led __metal_dt_led_0blue; + /* From spi@10014000 */ asm (".weak __metal_dt_spi_10014000"); struct __metal_driver_sifive_spi0 __metal_dt_spi_10014000; @@ -278,6 +291,36 @@ struct __metal_driver_sifive_gpio0 __metal_dt_gpio_10012000 = { .interrupt_lines[15] = 22, }; +/* From led@0red */ +struct __metal_driver_sifive_gpio_led __metal_dt_led_0red = { + .vtable = &__metal_driver_vtable_sifive_led, + .led.vtable = &__metal_driver_vtable_sifive_led.led_vtable, +/* From gpio@10012000 */ + .gpio = &__metal_dt_gpio_10012000, + .pin = 22UL, + .label = "LD0red", +}; + +/* From led@0green */ +struct __metal_driver_sifive_gpio_led __metal_dt_led_0green = { + .vtable = &__metal_driver_vtable_sifive_led, + .led.vtable = &__metal_driver_vtable_sifive_led.led_vtable, +/* From gpio@10012000 */ + .gpio = &__metal_dt_gpio_10012000, + .pin = 19UL, + .label = "LD0green", +}; + +/* From led@0blue */ +struct __metal_driver_sifive_gpio_led __metal_dt_led_0blue = { + .vtable = &__metal_driver_vtable_sifive_led, + .led.vtable = &__metal_driver_vtable_sifive_led.led_vtable, +/* From gpio@10012000 */ + .gpio = &__metal_dt_gpio_10012000, + .pin = 21UL, + .label = "LD0blue", +}; + /* From spi@10014000 */ struct __metal_driver_sifive_spi0 __metal_dt_spi_10014000 = { .vtable = &__metal_driver_vtable_sifive_spi0, @@ -403,11 +446,14 @@ struct __metal_driver_sifive_gpio0 *__metal_gpio_table[] = { asm (".weak __metal_button_table"); struct __metal_driver_sifive_gpio_button *__metal_button_table[] = { NULL }; -#define __METAL_DT_MAX_LEDS 0 +#define __METAL_DT_MAX_LEDS 3 asm (".weak __metal_led_table"); struct __metal_driver_sifive_gpio_led *__metal_led_table[] = { - NULL }; + &__metal_dt_led_0red, + &__metal_dt_led_0green, + &__metal_dt_led_0blue}; + #define __METAL_DT_MAX_SWITCHES 0 asm (".weak __metal_switch_table"); -- cgit v1.2.3