Skip to content

Commit e35a2e1

Browse files
Added POLARBERRY board support (SundanceDSP company)
Signed-off-by: Roman.K <roman.k@sundancedsp.com>
1 parent 5e94340 commit e35a2e1

26 files changed

+1205
-0
lines changed

Config.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ source "$BR2_EXTERNAL_MCHP_PATH/package/wilcmchp_firmware/Config.in"
1111
source "$BR2_EXTERNAL_MCHP_PATH/package/9bit/Config.in"
1212
source "$BR2_EXTERNAL_MCHP_PATH/package/plplot/Config.in"
1313
source "$BR2_EXTERNAL_MCHP_PATH/package/mpfs_examples/Config.in"
14+
source "$BR2_EXTERNAL_MCHP_PATH/package/hart-software-services/Config.in"
1415
source "$BR2_EXTERNAL_MCHP_PATH/package/hss-payload-generator/Config.in.host"
1516
source "$BR2_EXTERNAL_MCHP_PATH/package/mpfs_amp_examples/Config.in"
1617

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
images
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
BUILDROOT_DIRECTORY="/home/promwad/microchip_buildroot/buildroot-2023.08.1" #set here path the buildroot you are used for building
2+
#BUILDROOT_DIRECTORY="/home/promwad/microchip_buildroot/buildroot-2023.05" #set here path the buildroot you are used for building
3+
UART_DEVICE="/dev/ttyUSB1" #set here POLARBERRY board UART device in linux
4+
DEVICE_IP="192.168.1.72" #set here IP ADDRESS used for POLARBERRY board that you want to flash
5+
PC_IP="192.168.1.177" #set here IP ADDRESS of you PC
6+
IMAGE_NAME="fitimage_polarberry.itb" #set here file name of the linux image (it shall be placed in the TFTP directory)
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#
2+
# HSS Payload Generator - buildroot configuration file
3+
#
4+
5+
# First, we can optionally set a name for our image, otherwise one will be created dynamically
6+
set-name: 'Polarberry Fire-SoC-HSS::U-Boot'
7+
8+
#
9+
# Next, we'll define the entry point addresses for each hart, as follows:
10+
#
11+
hart-entry-points: {u54_1: '0x80200000', u54_2: '0x80200000', u54_3: '0x80200000', u54_4: '0x80200000'}
12+
13+
#
14+
# Finally, we'll define a payloads (source binary file) that will be placed at certain regions in memory
15+
# The payload section is defined with the keyword payloads, and then a number of individual
16+
# payload descriptors.
17+
#
18+
# Each payload has a name (path to its ELF/bin file), an owner-hart, and optionally 1-3 secondary-harts.
19+
#
20+
# Additionally, it has a privilege mode in which it will start execution.
21+
# * Valid privilege modes are PRV_M, PRV_S and PRV_U.
22+
#
23+
#
24+
# In this case, the only payload is the u-boot s-mode binary.
25+
#
26+
# Case only matters for the ELF path names, not the keywords.
27+
#
28+
payloads:
29+
src.bin: {
30+
exec-addr: '0x80200000',
31+
owner-hart: u54_1,
32+
secondary-hart: u54_2,
33+
secondary-hart: u54_3,
34+
secondary-hart: u54_4,
35+
priv-mode: prv_s
36+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
source ./FLASH_CONFIG.CONF
4+
5+
./Program_HSS_to_eNVM.sh
6+
./Program_UBOOT_to_eMMC.sh
7+
8+
echo "reset" > $UART_DEVICE
9+
10+
./Program_LINUX_to_eMMC.sh
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
source ./FLASH_CONFIG.CONF
3+
make -C $BUILDROOT_DIRECTORY/output/build/hart-software-services-next program
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/bash
2+
3+
source ./FLASH_CONFIG.CONF
4+
5+
stty -F $UART_DEVICE 115200 cs8 -cstopb -parenb raw
6+
7+
printf "\t\n ***** WAITING FOR UBOOT *****"
8+
9+
(
10+
while test "${key}" != "SundanceDSP"
11+
do
12+
read -r uart
13+
key=`echo $uart | grep "Model: SundanceDSP Polarberry" | awk '{print $2}'`
14+
# echo $uart
15+
done
16+
) < $UART_DEVICE
17+
18+
printf "\t\n ***** GOT THE TIMEOUT STRING FROM UBOOT *****"
19+
sleep 1
20+
echo ".\n" > $UART_DEVICE
21+
printf "\t\n ***** Starting programming linux image to the POLARBERRY board *****"
22+
echo "setenv ipaddr $DEVICE_IP" > $UART_DEVICE
23+
echo "setenv serverip $PC_IP" > $UART_DEVICE
24+
echo "setenv bootfile $IMAGE_NAME" > $UART_DEVICE
25+
echo "run flash_linux" > $UART_DEVICE
26+
sleep 1
27+
28+
(
29+
while test "${key}" != "MMC"
30+
do
31+
read -r uart
32+
key=`echo $uart | grep "MMC write" | awk '{print $1}'`
33+
# echo $uart
34+
done
35+
) < $UART_DEVICE
36+
37+
printf "\t\n ***** Programming LINUX to the eMMC of the POLARBERRY board is DONE!!! *****"
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/bash
2+
3+
source ./FLASH_CONFIG.CONF
4+
5+
stty -F $UART_DEVICE 115200 cs8 -cstopb -parenb raw
6+
7+
printf "\t\n ***** WAITING FOR HSS *****"
8+
9+
(
10+
while test "${key}" != "Timeout"
11+
do
12+
read -r uart
13+
key=`echo $uart | grep Timeout | awk '{print $1}'`
14+
done
15+
) < $UART_DEVICE
16+
17+
printf "\t\n ***** GOT THE TIMEOUT STRING *****"
18+
19+
echo "" > $UART_DEVICE
20+
printf "\t\n Starting \"ymodem\" command"
21+
echo "ymodem" > $UART_DEVICE
22+
sleep 1
23+
printf "\t\n Starting init eMMC command"
24+
echo "2" > $UART_DEVICE
25+
sleep 1
26+
printf "\t\n Starting ymodem receiving command\n"
27+
echo "3" > $UART_DEVICE
28+
sleep 1
29+
30+
sz -b --ymodem $BUILDROOT_DIRECTORY/output/images/payload.bin > $UART_DEVICE < $UART_DEVICE
31+
32+
printf "\t\n Saving the UBOOT to the eMMC memory"
33+
echo "5" > $UART_DEVICE
34+
sleep 2
35+
echo "6" > $UART_DEVICE
36+
sleep 1
37+
printf "\t\n ***** Programming U-BOOT to the eMMC of the POLARBERRY board is DONE!!! *****"

board/microchip/polarberry/README

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
After that in the directory "/home/promwad/microchip_buildroot/buildroot-external-microchip/board/microchip/polarberry" you can find script for board flashing.
2+
3+
There are 4 scipts:
4+
1) Program_HSS_to_eNVM.sh
5+
2) Program_UBOOT_to_eMMC.sh
6+
3) Program_LINUX_to_eNVM.sh
7+
4) Program_ALL_to_Polarberry.sh
8+
9+
and settings file: FLASH_CONFIG.CONF
10+
11+
Script is used to burn images to the Polarberry board.
12+
13+
The 1th is used to program ONLY HSS bootloader umage to the Polarberry board.
14+
The 2th is used to program ONLY UBOOT image to the Polarberry board.
15+
The 3th is used to program ONLY LINUX (Kernel and root filesystem, bith) image to the Polarberry board.
16+
The 4th is used to program ALL (HSS, UBOOT, LINUX) images to the Polarberry oard.
17+
18+
19+
The 1th script can be used with virgin Polarberry boards and requires ONLY JTAG connection with the board.
20+
The 2th script can be used only after 1th was used (it means UBOOT programming requires HSS was installed before)
21+
and requires JTAG and UART connection with the board.
22+
The 3th script can be used only after 2th was used (it means Linux programming requires UBOOT (as HSS toot)
23+
was installed before) and requires JTAG, UART and ETHERNET connection with the board.
24+
The 4th script runs 1,2,3 one-by-one and do all thunigs that do 1,2,3 in automatic mode and requires JTAG
25+
UART and ETHERNET connection with the board. Can be used with virgin Polarberry boards too.
26+
27+
Before script can be used, you need to fix values in FLASH_CONFIG.CONF according to your PC.
28+
The file contains strings with comments, so you can advice what you need:
29+
30+
BUILDROOT_DIRECTORY - here you need to set PATH to the buildroot you are using
31+
UART_DEVICE - here you need to set the name of the UART in your system. (/dev/ttyUSB1 for example)
32+
DEVICE_IP - here you need to set IP ADDRESS that will be set on the board during flashing.
33+
It shall be one of the free/unused IP addresses from you network.
34+
35+
PC_IP - here you need to set IP ADDRESS of the PC you are using. (It can be obtained via "ifconfig" command)
36+
IMAGE_NAME - here you need to set file name with LINUX image that is placed on the TFTP server
37+
(default value is "fitimage_polarberry.itb", and this file is built by buildroot and placed in "output/images" directory)
38+
39+
40+
To start building images via buildroot you need to run this command in buildrood sources:
41+
1) "make sundancedsp_polarberry_defconfig BR2_EXTERNAL=../buildroot-external-microchip"
42+
(where BR2_EXTERNAL shall point to the mbuildroot microsemi sources).
43+
44+
2) "make"
45+
Building will take time. Succesfull building will finish like this:
46+
47+
FIT description: Linux fitImage for Polaberry
48+
Created: Wed Nov 22 05:06:16 2023
49+
Image 0 (kernel-0)
50+
Description: Linux Kernel
51+
Created: Wed Nov 22 05:06:16 2023
52+
Type: Kernel Image
53+
Compression: uncompressed
54+
Data Size: 17612800 Bytes = 17200.00 KiB = 16.80 MiB
55+
Architecture: RISC-V
56+
OS: Linux
57+
Load Address: 0x80200000
58+
Entry Point: 0x80200000
59+
Hash algo: sha256
60+
Hash value: 466f36e4c778103ce7ef2fa9dc3456cb1e25d291fe71ab96f3d88ac588004f11
61+
Image 1 (fdt-0)
62+
Description: Flattened Device Tree blob
63+
Created: Wed Nov 22 05:06:16 2023
64+
Type: Flat Device Tree
65+
Compression: uncompressed
66+
Data Size: 14949 Bytes = 14.60 KiB = 0.01 MiB
67+
Architecture: RISC-V
68+
Hash algo: sha256
69+
Hash value: 1ccea6c67588f89a9227a5018b98048390728ef3a21ba90cbd69d8ab750843a4
70+
Image 2 (ramdisk-0)
71+
Description: ramdisk
72+
Created: Wed Nov 22 05:06:16 2023
73+
Type: RAMDisk Image
74+
Compression: uncompressed
75+
Data Size: 4921601 Bytes = 4806.25 KiB = 4.69 MiB
76+
Architecture: AArch64
77+
OS: Linux
78+
Load Address: unavailable
79+
Entry Point: unavailable
80+
Hash algo: sha256
81+
Hash value: cae144f8a5c8eb441ba01aae3d3dc1c88ea0303afe710e7d7528d04b0e963997
82+
Default Configuration: 'conf-1'
83+
Configuration 0 (conf-1)
84+
Description: Boot Linux kernel with FDT blob + ramdisk
85+
Kernel: kernel-0
86+
Init Ramdisk: ramdisk-0
87+
FDT: fdt-0
88+
Hash algo: sha256
89+
Hash value: unavailable
90+
Configuration 1 (conf-2)
91+
Description: Boot Linux kernel with FDT blob
92+
Kernel: kernel-0
93+
FDT: fdt-0
94+
Hash algo: sha256
95+
Hash value: unavailable
96+
97+
98+
To flash the images to the Polarberry board:
99+
1) Fix FLASH_CONFIG.CONF file in the board/microchip/polarberry directory.
100+
2) Power ON the Polarberry board
101+
3) run "Program_ALL_to_Polarberry.sh", and wait until all finished.
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/dts-v1/;
2+
3+
/ {
4+
description = "Linux fitImage for Polaberry";
5+
#address-cells = <1>;
6+
7+
images {
8+
kernel-0 {
9+
description = "Linux Kernel";
10+
data = /incbin/("images/Image");
11+
type = "kernel";
12+
arch = "riscv";
13+
os = "linux";
14+
compression = "none";
15+
load = <0x80200000>;
16+
entry = <0x80200000>;
17+
hash-1 {
18+
algo = "sha256";
19+
};
20+
};
21+
22+
fdt-0 {
23+
description = "Flattened Device Tree blob";
24+
data = /incbin/("images/linux_polarberry.dtb");
25+
type = "flat_dt";
26+
arch = "riscv";
27+
compression = "none";
28+
hash-1 {
29+
algo = "sha256";
30+
};
31+
};
32+
33+
ramdisk-0 {
34+
description = "ramdisk";
35+
data = /incbin/("images/rootfs.cpio.bz2");
36+
type = "ramdisk";
37+
arch = "arm64";
38+
os = "linux";
39+
compression = "none";
40+
hash-1 {
41+
algo = "sha256";
42+
};
43+
};
44+
};
45+
46+
configurations {
47+
default = "conf-1";
48+
conf-1 {
49+
description = "Boot Linux kernel with FDT blob + ramdisk";
50+
kernel = "kernel-0";
51+
fdt = "fdt-0";
52+
ramdisk = "ramdisk-0";
53+
hash-1 {
54+
algo = "sha256";
55+
};
56+
};
57+
conf-2 {
58+
description = "Boot Linux kernel with FDT blob";
59+
kernel = "kernel-0";
60+
fdt = "fdt-0";
61+
hash-1 {
62+
algo = "sha256";
63+
};
64+
};
65+
};
66+
};

0 commit comments

Comments
 (0)