diff --git a/boards/risc-v/k230/canmv230/scripts/Make.defs b/boards/risc-v/k230/canmv230/scripts/Make.defs index 16db926273b..ec30df90ea4 100644 --- a/boards/risc-v/k230/canmv230/scripts/Make.defs +++ b/boards/risc-v/k230/canmv230/scripts/Make.defs @@ -48,3 +48,18 @@ CXXELFFLAGS = $(CXXFLAGS) LDELFFLAGS = --oformat elf64-littleriscv LDELFFLAGS += -r -e main LDELFFLAGS += -T $(call CONVERT_PATH,$(TOPDIR)/binfmt/libelf/gnu-elf.ld) + +# POSTBUILD management + +ifeq ($(CONFIG_BUILD_KERNEL),y) +ifeq ($(wildcard $(BOARD_DIR)$(DELIM)src$(DELIM)romfs_boot.c),) +define POSTBUILD + $(Q) echo "Please replace stub ROMFS w/ real one." + $(Q) rm $(BOARD_DIR)$(DELIM)src$(DELIM)libboard.a +endef +else +define POSTBUILD + $(Q) echo "wrap nuttx.bin w/ SBI to run on target." +endef +endif +endif diff --git a/boards/risc-v/k230/canmv230/scripts/ld-flat.script b/boards/risc-v/k230/canmv230/scripts/ld-flat.script index 400a5831cda..ea74c85935d 100644 --- a/boards/risc-v/k230/canmv230/scripts/ld-flat.script +++ b/boards/risc-v/k230/canmv230/scripts/ld-flat.script @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/risc-v/qemu-rv/rv-virt/scripts/ld.script + * boards/risc-v/k230/canmv230/scripts/ld-flat.script * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -20,7 +20,7 @@ SECTIONS { - . = 0x08000000; + . = 0x8000000; .text : { @@ -114,7 +114,7 @@ SECTIONS _ebss = . ; } - /* Stabs debugging sections. */ + /* Stabs debugging sections. */ .stab 0 : { *(.stab) } .stabstr 0 : { *(.stabstr) } diff --git a/boards/risc-v/k230/canmv230/scripts/ld-kernel.script b/boards/risc-v/k230/canmv230/scripts/ld-kernel.script index 745ead8bba5..ccba5d21015 100644 --- a/boards/risc-v/k230/canmv230/scripts/ld-kernel.script +++ b/boards/risc-v/k230/canmv230/scripts/ld-kernel.script @@ -126,7 +126,7 @@ SECTIONS _ebss = ABSOLUTE(.); } > ksram - /* Stabs debugging sections. */ + /* Stabs debugging sections. */ .stab 0 : { *(.stab) } .stabstr 0 : { *(.stabstr) } diff --git a/boards/risc-v/k230/canmv230/src/Makefile b/boards/risc-v/k230/canmv230/src/Makefile index d73534315b4..352df6a5929 100644 --- a/boards/risc-v/k230/canmv230/src/Makefile +++ b/boards/risc-v/k230/canmv230/src/Makefile @@ -25,7 +25,17 @@ RCSRCS = etc/init.d/rc.sysinit etc/init.d/rcS CSRCS = canmv_init.c ifeq ($(CONFIG_BUILD_KERNEL),y) -CSRCS += $(wildcard romfs_*.c) +CSRCS += $(if $(wildcard romfs_boot.c), romfs_boot.c, romfs_stub.c) endif include $(TOPDIR)/boards/Board.mk + +# don't use single-colon targets as they may coflict with those included ones. +# use double-colon targets to avoid collisions below. + +ifeq ($(CONFIG_BUILD_KERNEL),y) +.PHONY: clean +clean:: + $(call DELFILE, romfs_boot.c) +endif + diff --git a/boards/risc-v/k230/canmv230/src/canmv_init.c b/boards/risc-v/k230/canmv230/src/canmv_init.c index 9047d575193..06265b6aacb 100644 --- a/boards/risc-v/k230/canmv230/src/canmv_init.c +++ b/boards/risc-v/k230/canmv230/src/canmv_init.c @@ -125,20 +125,16 @@ void board_late_initialize(void) #ifdef CONFIG_BUILD_KERNEL /* Create ROM disk for mount in nx_start_application */ - if (NSECTORS(romfs_img_len) > 5) + if (NSECTORS(romfs_img_len) > 1) { int ret = OK; ret = romdisk_register(0, romfs_img, NSECTORS(romfs_img_len), SECTORSIZE); if (ret < 0) { - serr("ERROR: Failed to register romfs: %d\n", -ret); + ferr("ERROR: Failed to register romfs: %d\n", -ret); } } - else - { - swarn("ROMFS too small: %d\n", NSECTORS(romfs_img_len)); - } #endif /* CONFIG_BUILD_KERNEL */ #ifdef CONFIG_NSH_ARCHINIT diff --git a/boards/risc-v/k230/canmv230/src/romfs_stub.c b/boards/risc-v/k230/canmv230/src/romfs_stub.c index 3ca1ec783bb..ea39e5e6a3c 100644 --- a/boards/risc-v/k230/canmv230/src/romfs_stub.c +++ b/boards/risc-v/k230/canmv230/src/romfs_stub.c @@ -27,7 +27,7 @@ weak_data const unsigned char aligned_data(4) romfs_img[] = { 0x00 }; -weak_data unsigned int romfs_img_len = 1; +weak_data const unsigned int romfs_img_len = 1; /**************************************************************************** * Private Functions