Skip to content

Commit

Permalink
feat: Added RISC-V sparkfun red board
Browse files Browse the repository at this point in the history
Signed-off-by: Taras Drozdovskyi <[email protected]>
  • Loading branch information
tdrozdovsky committed May 13, 2024
1 parent e687493 commit c0b3a90
Show file tree
Hide file tree
Showing 475 changed files with 116,216 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ $(TOPDIR)/toolchain/$(GCC_SOURCE):

gcc-unpacked: $(TOPDIR)/toolchain/$(GCC_SOURCE)
$(Q) if [ ! -d $(TOOLCHAINPATH) ]; then \
tar xjf $(TOPDIR)/toolchain/$(GCC_SOURCE) -C $(TOPDIR)/toolchain ; \
tar xvf $(TOPDIR)/toolchain/$(GCC_SOURCE) -C $(TOPDIR)/toolchain ; \
fi

toolchain: check_context Make.defs .config $(TOPDIR)/toolchain/$(GCC_SOURCE) gcc-unpacked
Expand Down
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,22 @@ the beginnings of corresponding files; also, all licenses are listed in
---
## 3. Platforms supported

| **NuMaker-PFM-M2351** | **M2351-Badge** | **V2M-MPS2-Qemu** | **How to add a platform** |
| **NuMaker-PFM-M2351** | **M2351-Badge** | **V2M-MPS2-Qemu** | **RISCV SparkFun RedBoard** |
|-----------------------|---------------------------|-------------|-----------|
|[![](docs/images/platforms/numaker_pfm_m2351/numaker_pfm_m2351.png)](docs/numaker_pfm_m2351.md)|[![](docs/images/platforms/m2351_badge/m2351_badge.png)](docs/m2351_badge.md) |[![V2M-MPS2-Qemu](docs/images/platforms/v2m-mps2/v2m-mps2.png)](docs/v2m-mps2-qemu.md)|[![](docs/images/platforms/add_new_board.jpg)](docs/port-new-platform.md)|
|[![](docs/images/platforms/numaker_pfm_m2351/numaker_pfm_m2351.png)](docs/numaker_pfm_m2351.md)|[![](docs/images/platforms/m2351_badge/m2351_badge.png)](docs/m2351_badge.md) |[![V2M-MPS2-Qemu](docs/images/platforms/v2m-mps2/v2m-mps2.png)](docs/v2m-mps2-qemu.md)|[![](docs/images/platforms/sparkfun_redboard/sparkfun_redboard.png)](docs/sparkfun_redboard.md)|
| **How to add a platform** ||||
|[![](docs/images/platforms/add_new_board.jpg)](docs/port-new-platform.md)||||


Several platforms are supported. In order to manage slight differences
between platforms, a `PLATFORM` flag has been introduced.

| Platform | Composite PLATFORM flag | Maintained |
|-----------------------|------------------------------------|------------|
| [NuMaker-PFM-M2351] |`PLATFORM=numaker_pfm_m2351` | v0.4 |
| [M2351-Badge] |`PLATFORM=m2351_badge` | v0.4 |
| [V2M-MPS2-Qemu] |`PLATFORM=mps2_an505_qemu` | v0.4 |
| Platform | Composite PLATFORM flag | Maintained |
|---------------------------|------------------------------------|------------|
| [NuMaker-PFM-M2351] |`PLATFORM=numaker_pfm_m2351` | v0.4 |
| [M2351-Badge] |`PLATFORM=m2351_badge` | v0.4 |
| [V2M-MPS2-Qemu] |`PLATFORM=mps2_an505_qemu` | v0.4 |
| [SparkFun RED-V RedBoard] |`PLATFORM=sparkfun_redboard` | v0.5 |

For information on adding a new platform see the [how to add a platform].

Expand Down Expand Up @@ -98,3 +101,4 @@ you can find here](.github/CONTRIBUTING.md).
[NuMaker-PFM-M2351]: http://www.nuvoton.com.cn/hq/products/iot-solution/iot-platform/numaker-maker-platform/numaker-pfm-m2351?__locale=en
[M2351-Badge]: docs/schemes/m2351_badge
[V2M-MPS2-Qemu]: https://developer.arm.com/documentation/100964/1114/Microcontroller-Prototyping-System-2?lang=en
[SparkFun RED-V RedBoard]: https://www.sparkfun.com/products/15594
22 changes: 21 additions & 1 deletion arch/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,18 @@ config ARCH_CORTEX_M33
---help---
The ARM architecture

config ARCH_RISCV_32
bool "riscv32"
---help---
The ARM architecture

endchoice

config ARCH
string
default "cortex-m23" if ARCH_CORTEX_M23
default "cortex-m33" if ARCH_CORTEX_M33
default "riscv32" if ARCH_RISCV_32

if ARCH_CORTEX_M23
source arch/cortex-m23/Kconfig
Expand All @@ -32,6 +38,10 @@ if ARCH_CORTEX_M33
source arch/cortex-m33/Kconfig
endif

if ARCH_RISCV_32
source arch/riscv32/Kconfig
endif

comment "Toolchain Configuration Options"
choice
prompt "Toolchain Selection"
Expand All @@ -53,6 +63,12 @@ config GCC_VERSION_8_2018Q4
# depends on ARCH_FAMILY_MPS2
# bool "GCC compiler Version: 8 2019 q3"

config GCC_VERSION_10_2_0_2020_12
bool "GCC compiler Version: SiFive GCC-Metal 10.2.0-2020.12.8"

config GCC_VERSION_T_HEAD_10_2_0
bool "GCC compiler Version: T-Head GCC 10.2.0"

endchoice

config GCC_VERSION
Expand All @@ -61,6 +77,7 @@ config GCC_VERSION
default arm-none-eabi-6-2017-q2-update-linux if GCC_VERSION_6_1_2017Q2
default arm-none-eabi-8-2018-q4-major-linux if GCC_VERSION_8_2018Q4
# default gcc-arm-none-eabi-8-2019-q3-update-linux if GCC_VERSION_8_2019Q3
default riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14 if GCC_VERSION_10_2_0_2020_12

config GCC_SITE
string
Expand All @@ -70,11 +87,14 @@ config GCC_SITE
# default "https://developer.arm.com/-/media/Files/downloads/gnu-rm/8-2019q3" if GCC_VERSION_8_2019Q3
# default "https://developer.arm.com/-/media/Files/downloads/gnu-rm/8-2019q3/RC1.1" if GCC_VERSION_8_2019Q3
# https://developer.arm.com/-/media/Files/downloads/gnu-rm/8-2019q3/RC1.1/gcc-arm-none-eabi-8-2019-q3-update-linux.tar.bz2?revision=c34d758a-be0c-476e-a2de-af8c6e16a8a2?product=GNU%20Arm%20Embedded%20Toolchain%20Downloads,64-bit,,Linux,8-2019-q3-update
default "https://static.dev.sifive.com/dev-tools/freedom-tools/v2020.12" if GCC_VERSION_10_2_0_2020_12
default "https://github.com/bouffalolab/toolchain_gcc_t-head_linux" if GCC_VERSION_T_HEAD_10_2_0

config GCC_FOLDER
string
default "gcc-arm-none-eabi-6-2017-q1-update" if GCC_VERSION_6_1_2017Q1
default "gcc-arm-none-eabi-6-2017-q2-update" if GCC_VERSION_6_1_2017Q2
default "gcc-arm-none-eabi-8-2018-q4-major" if GCC_VERSION_8_2018Q4
# default "gcc-arm-none-eabi-8-2019-q3-update" if GCC_VERSION_8_2019Q3

default "riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14" if GCC_VERSION_10_2_0_2020_12
default "toolchain_gcc_t-head_linux-master" if GCC_VERSION_T_HEAD_10_2_0
2 changes: 1 addition & 1 deletion arch/cortex-m23/m2351/src/m2351_badge/nonsecure/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ $(COBJS_NS): $(OBJDIR)/%$(OBJEXT): %.c
$(Q) $(CC) -c $(CFLAGS) $< -o $@

mtower_ns$(EXEEXT): $(OBJS_NS)
$(Q) $(MAKE) -C $(TOPDIR)/freertos/ TOPDIR="$(TOPDIR)" libFreeRTOS_ns.a
$(Q) $(MAKE) -C $(TOPDIR)/freertos/ TOPDIR="$(TOPDIR)" FREE_RTOS_ARCH=ARM_V8M libFreeRTOS_ns.a
$(Q) $(MAKE) -C ../../StdDriver/src/ TOPDIR="$(TOPDIR)" libm2351_StdDriver_ns.a
@echo "LD: mTower_ns$(EXEEXT)"
$(Q) $(CC) $(CFLAGS) -Wl,--section-start=.text=$(CONFIG_START_ADDRESS_BL33) -Tnonsecure.ld $(OBJS_NS) $(LIBPATHS) $(LIBS) -o $(OBJDIR)/bl33.elf
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ $(COBJS_NS): $(OBJDIR)/%$(OBJEXT): %.c
$(Q) $(CC) -c $(CFLAGS) $< -o $@

mtower_ns$(EXEEXT): $(OBJS_NS)
$(Q) $(MAKE) -C $(TOPDIR)/freertos/ TOPDIR="$(TOPDIR)" libFreeRTOS_ns.a
$(Q) $(MAKE) -C $(TOPDIR)/freertos/ TOPDIR="$(TOPDIR)" FREE_RTOS_ARCH=ARM_V8M libFreeRTOS_ns.a
$(Q) $(MAKE) -C ../../StdDriver/src/ TOPDIR="$(TOPDIR)" libm2351_StdDriver_ns.a
@echo "LD: mTower_ns$(EXEEXT)"
$(Q) $(CC) $(CFLAGS) -Wl,--section-start=.text=$(CONFIG_START_ADDRESS_BL33) -Tnonsecure.ld $(OBJS_NS) $(LIBPATHS) $(LIBS) -o $(OBJDIR)/bl33.elf
Expand Down
3 changes: 1 addition & 2 deletions arch/cortex-m33/mps2/src/mps2_an505_qemu/nonsecure/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ OBJS_NS = $(AOBJS_NS) $(COBJS_NS)

LIBPATHS = -L. -L"$(TOPDIR)/lib"

# LIBS = -lm -lc -lnosys -lStdDriver_ns -lnsc -lFreeRTOS_ns
LIBS = -lm -lc -lnosys -lnsc -lFreeRTOS_ns

$(AOBJS_NS): $(OBJDIR)/%$(OBJEXT): %.S
Expand All @@ -90,7 +89,7 @@ $(COBJS_NS): $(OBJDIR)/%$(OBJEXT): %.c
$(Q) $(CC) -c $(CFLAGS) $< -o $@

mtower_ns$(EXEEXT): $(OBJS_NS)
$(Q) $(MAKE) -C $(TOPDIR)/freertos/ TOPDIR="$(TOPDIR)" libFreeRTOS_ns.a
$(Q) $(MAKE) -C $(TOPDIR)/freertos/ TOPDIR="$(TOPDIR)" FREE_RTOS_ARCH=ARM_V8M libFreeRTOS_ns.a
# $(Q) $(MAKE) -C ../../StdDriver/src/ TOPDIR="$(TOPDIR)" libStdDriver_ns.a
@echo "LD: mTower_ns$(EXEEXT)"
$(Q) $(CC) $(CFLAGS) -Tnonsecure.ld $(OBJS_NS) $(LIBPATHS) $(LIBS) -Wl,-Map=output.map -o $(OBJDIR)/bl33.elf
Expand Down
36 changes: 36 additions & 0 deletions arch/riscv32/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the docs folder of mTower repository.
#

choice
prompt "MCU Family"
default FE310

config ARCH_FAMILY_FE310
bool "FE310"
---help---
The FE310 architecture

config ARCH_FAMILY_BL808
bool "BL808"
---help---
The BL808 architecture

endchoice

config ARCH_FAMILY
string
default "fe310" if ARCH_FAMILY_FE310
default "bl808" if ARCH_FAMILY_BL808

if ARCH_FAMILY_FE310
comment "FE310 Configuration Options"
source arch/riscv32/fe310/Kconfig
endif

if ARCH_FAMILY_BL808
comment "BL808 Configuration Options"
source arch/riscv32/bl808/Kconfig
endif

Loading

0 comments on commit c0b3a90

Please sign in to comment.