All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v3 0/4] Support Andes SPI_burn tool
@ 2024-09-10  6:26 Yu Chien Peter Lin via buildroot
  2024-09-10  6:26 ` [Buildroot] [PATCH v3 1/4] package/andes-spi-burn: new package Yu Chien Peter Lin via buildroot
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Yu Chien Peter Lin via buildroot @ 2024-09-10  6:26 UTC (permalink / raw)
  To: buildroot; +Cc: tim609, Yu Chien Peter Lin, ycliang, Thomas Petazzoni

This series adds support for Andes SPI_burn tool that can be used to
update flash memory for U-Boot and OpenSBI development.

Changes v1->v2:
- Add documentation in the readme.txt
Changes v2->v3:
- Resolve comments on v2 patches: https://patchwork.ozlabs.org/project/buildroot/patch/20240904051609.2871616-2-peterlin@andestech.com/
  - Fix indentation of the help text
  - Add LICENSE file
  - Rename downloaded zip file with package version
  - Do not `make clean` before compiling
  - Add links for ICEman & AICE in andes/ae350/readme.txt


Yu Chien Peter Lin (4):
  package/andes-spi-burn: new package
  configs/andes_ae350_45: Enable host-andes-spi-burn
  board/andes/ae350: uboot.config.fragment: Support loading U-Boot on
    RAM
  board/andes/ae350: readme.txt: Add SPI_burn tool instructions

 DEVELOPERS                                 |  1 +
 board/andes/ae350/readme.txt               | 43 ++++++++++++++++++++++
 board/andes/ae350/uboot.config.fragment    |  1 -
 configs/andes_ae350_45_defconfig           |  1 +
 package/Config.in.host                     |  1 +
 package/andes-spi-burn/Config.in.host      |  8 ++++
 package/andes-spi-burn/andes-spi-burn.hash |  3 ++
 package/andes-spi-burn/andes-spi-burn.mk   | 27 ++++++++++++++
 8 files changed, 84 insertions(+), 1 deletion(-)
 create mode 100644 package/andes-spi-burn/Config.in.host
 create mode 100644 package/andes-spi-burn/andes-spi-burn.hash
 create mode 100644 package/andes-spi-burn/andes-spi-burn.mk

-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH v3 1/4] package/andes-spi-burn: new package
  2024-09-10  6:26 [Buildroot] [PATCH v3 0/4] Support Andes SPI_burn tool Yu Chien Peter Lin via buildroot
@ 2024-09-10  6:26 ` Yu Chien Peter Lin via buildroot
  2024-09-14 19:00   ` Thomas Petazzoni via buildroot
  2024-09-10  6:26 ` [Buildroot] [PATCH v3 2/4] configs/andes_ae350_45: Enable host-andes-spi-burn Yu Chien Peter Lin via buildroot
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Yu Chien Peter Lin via buildroot @ 2024-09-10  6:26 UTC (permalink / raw)
  To: buildroot; +Cc: tim609, Yu Chien Peter Lin, ycliang, Thomas Petazzoni

Add a new package for Andes AE350 SPI_burn tool to program
flash memory.

Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
---
 DEVELOPERS                                 |  1 +
 package/Config.in.host                     |  1 +
 package/andes-spi-burn/Config.in.host      |  8 +++++++
 package/andes-spi-burn/andes-spi-burn.hash |  3 +++
 package/andes-spi-burn/andes-spi-burn.mk   | 27 ++++++++++++++++++++++
 5 files changed, 40 insertions(+)
 create mode 100644 package/andes-spi-burn/Config.in.host
 create mode 100644 package/andes-spi-burn/andes-spi-burn.hash
 create mode 100644 package/andes-spi-burn/andes-spi-burn.mk

diff --git a/DEVELOPERS b/DEVELOPERS
index 069965680b..aab5a6c05f 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -2487,6 +2487,7 @@ N:	Yu Chien Peter Lin <peterlin@andestech.com>
 F:	board/andes
 F:	configs/andes_ae350_45_defconfig
 F:	package/kmon/
+F:	package/andes-spi-burn/
 
 N:	Olaf Rempel <razzor@kopf-tisch.de>
 F:	package/ctorrent/
diff --git a/package/Config.in.host b/package/Config.in.host
index e4fbee4f2a..191833d94d 100644
--- a/package/Config.in.host
+++ b/package/Config.in.host
@@ -4,6 +4,7 @@ menu "Host utilities"
 	source "package/aespipe/Config.in.host"
 	source "package/agent-proxy/Config.in.host"
 	source "package/amlogic-boot-fip/Config.in.host"
+	source "package/andes-spi-burn/Config.in.host"
 	source "package/android-tools/Config.in.host"
 	source "package/asn1c/Config.in.host"
 	source "package/babeltrace2/Config.in.host"
diff --git a/package/andes-spi-burn/Config.in.host b/package/andes-spi-burn/Config.in.host
new file mode 100644
index 0000000000..cd92b448bf
--- /dev/null
+++ b/package/andes-spi-burn/Config.in.host
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_HOST_ANDES_SPI_BURN
+	bool "host andes-spi-burn"
+	depends on BR2_riscv
+	help
+	  Andes Technology SPI_burn tool to program bootloader and
+	  device-tree blob onto flash memory of AE350 platform.
+
+	  https://github.com/andestech/Andes-Development-Kit
diff --git a/package/andes-spi-burn/andes-spi-burn.hash b/package/andes-spi-burn/andes-spi-burn.hash
new file mode 100644
index 0000000000..5e4b4c8c97
--- /dev/null
+++ b/package/andes-spi-burn/andes-spi-burn.hash
@@ -0,0 +1,3 @@
+# Locally computed
+sha256  d354611540a553fe59ea5a1660426d13c43fb29c378734fe455af2ea6e85b728  flash_v5.3.0.zip
+sha256  cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30  LICENSE
diff --git a/package/andes-spi-burn/andes-spi-burn.mk b/package/andes-spi-burn/andes-spi-burn.mk
new file mode 100644
index 0000000000..45f9638d27
--- /dev/null
+++ b/package/andes-spi-burn/andes-spi-burn.mk
@@ -0,0 +1,27 @@
+################################################################################
+#
+# andes-spi-burn
+#
+################################################################################
+
+ANDES_SPI_BURN_VERSION = 5.3.0
+ANDES_SPI_BURN_SOURCE = flash_v$(ANDES_SPI_BURN_VERSION).zip
+ANDES_SPI_BURN_SITE = https://github.com/andestech/meta-andes/releases/download/ast-v5_3_0-release
+ANDES_SPI_BURN_LICENSE = Apache-2.0
+ANDES_SPI_BURN_FILES = LICENSE
+
+define HOST_ANDES_SPI_BURN_EXTRACT_CMDS
+	$(UNZIP) $(HOST_ANDES_SPI_BURN_DL_DIR)/$(ANDES_SPI_BURN_SOURCE) -d $(@D)
+	mv $(@D)/flash/* $(@D)
+	rmdir $(@D)/flash
+endef
+
+define HOST_ANDES_SPI_BURN_BUILD_CMDS
+	$(HOST_MAKE_ENV) $(MAKE) -C $(@D)/src-SPI_burn --makefile=Makefile_SPIburn_linux
+endef
+
+define HOST_ANDES_SPI_BURN_INSTALL_CMDS
+	$(INSTALL) -D -m 0755 $(@D)/src-SPI_burn/SPI_burn $(HOST_DIR)/bin/SPI_burn
+endef
+
+$(eval $(host-generic-package))
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH v3 2/4] configs/andes_ae350_45: Enable host-andes-spi-burn
  2024-09-10  6:26 [Buildroot] [PATCH v3 0/4] Support Andes SPI_burn tool Yu Chien Peter Lin via buildroot
  2024-09-10  6:26 ` [Buildroot] [PATCH v3 1/4] package/andes-spi-burn: new package Yu Chien Peter Lin via buildroot
@ 2024-09-10  6:26 ` Yu Chien Peter Lin via buildroot
  2024-09-10  6:26 ` [Buildroot] [PATCH v3 3/4] board/andes/ae350: uboot.config.fragment: Support loading U-Boot on RAM Yu Chien Peter Lin via buildroot
  2024-09-10  6:26 ` [Buildroot] [PATCH v3 4/4] board/andes/ae350: readme.txt: Add SPI_burn tool instructions Yu Chien Peter Lin via buildroot
  3 siblings, 0 replies; 7+ messages in thread
From: Yu Chien Peter Lin via buildroot @ 2024-09-10  6:26 UTC (permalink / raw)
  To: buildroot; +Cc: tim609, Yu Chien Peter Lin, ycliang, Thomas Petazzoni

Enable Andes SPI_Burn tool for updating buildroot generated
bootloader and device-tree blob on flash memory.

Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
---
 configs/andes_ae350_45_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/andes_ae350_45_defconfig b/configs/andes_ae350_45_defconfig
index fd8b7db0e7..7b5a6f73c6 100644
--- a/configs/andes_ae350_45_defconfig
+++ b/configs/andes_ae350_45_defconfig
@@ -34,6 +34,7 @@ BR2_TARGET_UBOOT_NEEDS_OPENSBI=y
 BR2_TARGET_UBOOT_FORMAT_CUSTOM=y
 BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot.itb"
 BR2_TARGET_UBOOT_SPL=y
+BR2_PACKAGE_HOST_ANDES_SPI_BURN=y
 BR2_PACKAGE_HOST_DOSFSTOOLS=y
 BR2_PACKAGE_HOST_GENIMAGE=y
 BR2_PACKAGE_HOST_MTOOLS=y
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH v3 3/4] board/andes/ae350: uboot.config.fragment: Support loading U-Boot on RAM
  2024-09-10  6:26 [Buildroot] [PATCH v3 0/4] Support Andes SPI_burn tool Yu Chien Peter Lin via buildroot
  2024-09-10  6:26 ` [Buildroot] [PATCH v3 1/4] package/andes-spi-burn: new package Yu Chien Peter Lin via buildroot
  2024-09-10  6:26 ` [Buildroot] [PATCH v3 2/4] configs/andes_ae350_45: Enable host-andes-spi-burn Yu Chien Peter Lin via buildroot
@ 2024-09-10  6:26 ` Yu Chien Peter Lin via buildroot
  2024-09-10  6:26 ` [Buildroot] [PATCH v3 4/4] board/andes/ae350: readme.txt: Add SPI_burn tool instructions Yu Chien Peter Lin via buildroot
  3 siblings, 0 replies; 7+ messages in thread
From: Yu Chien Peter Lin via buildroot @ 2024-09-10  6:26 UTC (permalink / raw)
  To: buildroot; +Cc: tim609, Yu Chien Peter Lin, ycliang, Thomas Petazzoni

Do not disable SPL RAM support so the u-boot.itb programmed on
flash memory can be used.

Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
---
 board/andes/ae350/uboot.config.fragment | 1 -
 1 file changed, 1 deletion(-)

diff --git a/board/andes/ae350/uboot.config.fragment b/board/andes/ae350/uboot.config.fragment
index fa38bbca3a..4497ed4c74 100644
--- a/board/andes/ae350/uboot.config.fragment
+++ b/board/andes/ae350/uboot.config.fragment
@@ -1,6 +1,5 @@
 CONFIG_SPL_FS_FAT=y
 CONFIG_SPL_MMC=y
-# CONFIG_SPL_RAM_SUPPORT is not set
 CONFIG_SPL_OPENSBI_LOAD_ADDR=0x0
 CONFIG_SPL_OPENSBI_SCRATCH_OPTIONS=0x0
 CONFIG_DISPLAY_CPUINFO=y
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH v3 4/4] board/andes/ae350: readme.txt: Add SPI_burn tool instructions
  2024-09-10  6:26 [Buildroot] [PATCH v3 0/4] Support Andes SPI_burn tool Yu Chien Peter Lin via buildroot
                   ` (2 preceding siblings ...)
  2024-09-10  6:26 ` [Buildroot] [PATCH v3 3/4] board/andes/ae350: uboot.config.fragment: Support loading U-Boot on RAM Yu Chien Peter Lin via buildroot
@ 2024-09-10  6:26 ` Yu Chien Peter Lin via buildroot
  3 siblings, 0 replies; 7+ messages in thread
From: Yu Chien Peter Lin via buildroot @ 2024-09-10  6:26 UTC (permalink / raw)
  To: buildroot; +Cc: tim609, Yu Chien Peter Lin, ycliang, Thomas Petazzoni

Add a section to document how to update bootloader on AE350
platforms with SPI_burn tool.

Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
---
 board/andes/ae350/readme.txt | 43 ++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/board/andes/ae350/readme.txt b/board/andes/ae350/readme.txt
index 4de4cb3894..36561fc777 100644
--- a/board/andes/ae350/readme.txt
+++ b/board/andes/ae350/readme.txt
@@ -41,6 +41,49 @@ After building, you should obtain the following files:
   |-- u-boot-spl.bin
   `-- u-boot.itb
 
+How to update the bootloader and device-tree
+============================================
+
+To update the bootloader and device tree, make sure you have
+an ICEman (Andes OpenOCD [1]) and AICE [2] connection set up
+as below:
+
+  Local Host                 Local/Remote Host
+ .-----------------.          .--------------.
+ | buildroot images|          |              |
+ |                 |         ICEman host <IP:PORT>
+ | .----------.    |          |  .--------.  |
+ | | SPI_burn |<---+--socket--+->| ICEman |  |
+ | '----------'    |          |  '--.-----'  |
+ '-----------------'          '-----|--------'
+                                    |
+                                    USB
+   .--------------.                 |
+   | target       |           .-----v-----.
+   | board        <----JTAG---| AICE      |
+   |              |           '-----------'
+   '--------------'
+
+[1] https://github.com/andestech/ICEman
+[2] https://www.andestech.com/en/products-solutions/andeshape-platforms/aice-micro/
+
+The Andes SPI_burn tool will be located in output/host/bin. Use
+the following commands to update the bootloader and device tree:
+
+  $ SPI_burn --host $ICE_IP --port $ICE_BURNER_PORT --addr 0x0     -i u-boot-spl.bin
+  $ SPI_burn --host $ICE_IP --port $ICE_BURNER_PORT --addr 0x10000 -i u-boot.itb
+  $ SPI_burn --host $ICE_IP --port $ICE_BURNER_PORT --addr 0xf0000 -i ae350_ax45mp.dtb
+
+Note that the --addr option specifies the offset starting from
+the flash base address 0x80000000 and set by U-Boot configurations.
+e.g.
+u-boot-spl.bin  : CONFIG_SPL_TEXT_BASE=0x80000000
+u-boot.itb      : CONFIG_SPL_LOAD_FIT_ADDRESS=0x80010000
+ae350_ax45mp.dtb: CONFIG_SYS_FDT_BASE=0x800f0000
+
+How to write the SD card
+========================
+
 Copy the sdcard.img to a SD card with "dd":
 
   $ sudo dd if=sdcard.img of=/dev/sdX bs=4096
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [Buildroot] [PATCH v3 1/4] package/andes-spi-burn: new package
  2024-09-10  6:26 ` [Buildroot] [PATCH v3 1/4] package/andes-spi-burn: new package Yu Chien Peter Lin via buildroot
@ 2024-09-14 19:00   ` Thomas Petazzoni via buildroot
  2024-09-20 10:16     ` Yu-Chien Peter Lin via buildroot
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas Petazzoni via buildroot @ 2024-09-14 19:00 UTC (permalink / raw)
  To: Yu Chien Peter Lin via buildroot; +Cc: tim609, Yu Chien Peter Lin, ycliang

Hello,

On Tue, 10 Sep 2024 14:26:32 +0800
Yu Chien Peter Lin via buildroot <buildroot@buildroot.org> wrote:

> Add a new package for Andes AE350 SPI_burn tool to program
> flash memory.
> 
> Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>

Thanks for this new iteration. Unfortunately, there's still something
that doesn't work. It fails to build for me with:

/usr/bin/ld: cannot find -lm: No such file or directory
/usr/bin/ld: cannot find -lc: No such file or directory
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile_SPIburn_linux:25: SPI_burn] Error 1

that's because you link with -static, and I don't have the static
version of libc/libm installed on my machine.

So I wanted to patch that out, but the code is not even in the Github
repo at https://github.com/andestech/meta-andes/, so I can't create
a pull request. All you have published is a ZIP file with the source
code, buried deep inside the meta-andes Yocto layer repository. This
really isn't nice, and prevents people (like me) from actually
contributing fixes (like removing this bogus -static flag).

Could you instead create a proper Github repository for this project,
so that people can submit fixes, so that you can do tags, releases, etc.

> diff --git a/DEVELOPERS b/DEVELOPERS
> index 069965680b..aab5a6c05f 100644
> --- a/DEVELOPERS
> +++ b/DEVELOPERS
> @@ -2487,6 +2487,7 @@ N:	Yu Chien Peter Lin <peterlin@andestech.com>
>  F:	board/andes
>  F:	configs/andes_ae350_45_defconfig
>  F:	package/kmon/
> +F:	package/andes-spi-burn/

Alphabetic ordering is not correct here.

Best regards,

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Buildroot] [PATCH v3 1/4] package/andes-spi-burn: new package
  2024-09-14 19:00   ` Thomas Petazzoni via buildroot
@ 2024-09-20 10:16     ` Yu-Chien Peter Lin via buildroot
  0 siblings, 0 replies; 7+ messages in thread
From: Yu-Chien Peter Lin via buildroot @ 2024-09-20 10:16 UTC (permalink / raw)
  To: Thomas Petazzoni; +Cc: tim609, ycliang, Yu Chien Peter Lin via buildroot

Hi Thomas,

On Sat, Sep 14, 2024 at 09:00:30PM +0200, Thomas Petazzoni wrote:
> [EXTERNAL MAIL]
> 
> Hello,
> 
> On Tue, 10 Sep 2024 14:26:32 +0800
> Yu Chien Peter Lin via buildroot <buildroot@buildroot.org> wrote:
> 
> > Add a new package for Andes AE350 SPI_burn tool to program
> > flash memory.
> >
> > Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
> 
> Thanks for this new iteration. Unfortunately, there's still something
> that doesn't work. It fails to build for me with:
> 
> /usr/bin/ld: cannot find -lm: No such file or directory
> /usr/bin/ld: cannot find -lc: No such file or directory
> collect2: error: ld returned 1 exit status
> make[1]: *** [Makefile_SPIburn_linux:25: SPI_burn] Error 1
> 
> that's because you link with -static, and I don't have the static
> version of libc/libm installed on my machine.
> 
> So I wanted to patch that out, but the code is not even in the Github
> repo at https://github.com/andestech/meta-andes/, so I can't create
> a pull request. All you have published is a ZIP file with the source
> code, buried deep inside the meta-andes Yocto layer repository. This
> really isn't nice, and prevents people (like me) from actually
> contributing fixes (like removing this bogus -static flag).
> 
> Could you instead create a proper Github repository for this project,
> so that people can submit fixes, so that you can do tags, releases, etc.

Thank you for the review. I am in the process of creating a
dedicated GitHub repository for SPI_burn and will send PATCHv4
once the logistical issues are resolved.

> > diff --git a/DEVELOPERS b/DEVELOPERS
> > index 069965680b..aab5a6c05f 100644
> > --- a/DEVELOPERS
> > +++ b/DEVELOPERS
> > @@ -2487,6 +2487,7 @@ N:      Yu Chien Peter Lin <peterlin@andestech.com>
> >  F:   board/andes
> >  F:   configs/andes_ae350_45_defconfig
> >  F:   package/kmon/
> > +F:   package/andes-spi-burn/
> 
> Alphabetic ordering is not correct here.

Will fix, thanks.

Best regards,
Peter Lin

> Best regards,
> 
> Thomas
> --
> Thomas Petazzoni, co-owner and CEO, Bootlin
> Embedded Linux and Kernel engineering and training
> https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-09-20 10:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-10  6:26 [Buildroot] [PATCH v3 0/4] Support Andes SPI_burn tool Yu Chien Peter Lin via buildroot
2024-09-10  6:26 ` [Buildroot] [PATCH v3 1/4] package/andes-spi-burn: new package Yu Chien Peter Lin via buildroot
2024-09-14 19:00   ` Thomas Petazzoni via buildroot
2024-09-20 10:16     ` Yu-Chien Peter Lin via buildroot
2024-09-10  6:26 ` [Buildroot] [PATCH v3 2/4] configs/andes_ae350_45: Enable host-andes-spi-burn Yu Chien Peter Lin via buildroot
2024-09-10  6:26 ` [Buildroot] [PATCH v3 3/4] board/andes/ae350: uboot.config.fragment: Support loading U-Boot on RAM Yu Chien Peter Lin via buildroot
2024-09-10  6:26 ` [Buildroot] [PATCH v3 4/4] board/andes/ae350: readme.txt: Add SPI_burn tool instructions Yu Chien Peter Lin via buildroot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.