-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added POLARBERRY board support (SundanceDSP company) #11
base: master
Are you sure you want to change the base?
Changes from 1 commit
e35a2e1
f950da6
7953b25
22e2b3a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
images | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This directory should not be here and therefore there should be no need to add this file. Delete this file. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will be fixed |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file is not necessary. You should not be hardcoding/setting any of these statically. You can attain all of this information from Buildroot/the system itself, should it be required. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file is used for auto-flashing procedure based on BASH scripts. This procedure requires UART (device name in Linux)/ETHERNET(IP addresses of the PC and Board) and the base buildroot directory used for compilation. The UART can not be obtained from the system, due to user PC configuration may be different: PC may contain more than one USB/UART converter, etc. For example - my working PC contains two usb/uart converters that can be in "off state" time to time, it cause the issue: the polarberry board connected to a PC can be on a different device (/dev/ttyUSB0, /dev/ttyUSB1, /dev/ttyUSB2, etc.) and this can not be predicted/predefined. User shall set manually set UART device user for Polarberry... Also for IP-Addresses (PC/Polarberry). I can obtain Polarberry IP from buildroot configuration, but PC IP address also can not be obtained/predicted, due to PC may have more than one Ethernets, and only user knows what Ethernet Device user for Polarberry connection (For example, my PC has 3 Ethernet cards (one for office network and two for devices)... Also for buildroot directory: only user knows what directory is used for buildroot as "BR2_EXTERNAL", there are no other way to get the path to buildroot sources, except ask the user (via configuration file, for example). So, this is not hardcoded/statically settings, this is settings user shall to change/fix according to PC's configuration... Automatic process for board flashing is very useful for end-user. Is it possible to leave this file? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since you are running this outside of the Buildroot build and the end-user is going to be passing their own values, please make these arguments instead of having this file in-tree with these values set. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
BUILDROOT_DIRECTORY="/home/promwad/microchip_buildroot/buildroot-2023.08.1" #set here path the buildroot you are used for building | ||
#BUILDROOT_DIRECTORY="/home/promwad/microchip_buildroot/buildroot-2023.05" #set here path the buildroot you are used for building | ||
UART_DEVICE="/dev/ttyUSB1" #set here POLARBERRY board UART device in linux | ||
DEVICE_IP="192.168.1.72" #set here IP ADDRESS used for POLARBERRY board that you want to flash | ||
PC_IP="192.168.1.177" #set here IP ADDRESS of you PC | ||
IMAGE_NAME="fitimage_polarberry.itb" #set here file name of the linux image (it shall be placed in the TFTP directory) |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you please rename this file? Get rid of all the capitalisation. This should also have a yaml extension. Consider renaming to: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will be fixed |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# | ||
# HSS Payload Generator - buildroot configuration file | ||
# | ||
|
||
# First, we can optionally set a name for our image, otherwise one will be created dynamically | ||
set-name: 'Polarberry Fire-SoC-HSS::U-Boot' | ||
|
||
# | ||
# Next, we'll define the entry point addresses for each hart, as follows: | ||
# | ||
hart-entry-points: {u54_1: '0x80200000', u54_2: '0x80200000', u54_3: '0x80200000', u54_4: '0x80200000'} | ||
|
||
# | ||
# Finally, we'll define a payloads (source binary file) that will be placed at certain regions in memory | ||
# The payload section is defined with the keyword payloads, and then a number of individual | ||
# payload descriptors. | ||
# | ||
# Each payload has a name (path to its ELF/bin file), an owner-hart, and optionally 1-3 secondary-harts. | ||
# | ||
# Additionally, it has a privilege mode in which it will start execution. | ||
# * Valid privilege modes are PRV_M, PRV_S and PRV_U. | ||
# | ||
# | ||
# In this case, the only payload is the u-boot s-mode binary. | ||
# | ||
# Case only matters for the ELF path names, not the keywords. | ||
# | ||
payloads: | ||
src.bin: { | ||
exec-addr: '0x80200000', | ||
owner-hart: u54_1, | ||
secondary-hart: u54_2, | ||
secondary-hart: u54_3, | ||
secondary-hart: u54_4, | ||
priv-mode: prv_s | ||
} |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please rename file - remove random capitalisation. Similar to Linux programming script. Can you make use of the full generated sdcard.img instead of programming u-boot and linux separately? This is more prone to errors such as overriding partitions. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does "program_all.sh" fits? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Polarberry has no SD card. Image is split/separated for "uboot image" + "Linux image" due to not all users reflash the board with both SW (uboot+linux). In must cases I have faced, only virgin boards programmed via "programs_all", and next only Linux (less often uboot) is reflashed. That's why we created different scripts for different tasks. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The sdcard.img can be used to program U-Boot and Linux via eMMC. If you want to provide separate scripts for separate U-Boot and Linux programming for the reason above, that is fine. I am asking if you can utilise the sdcard.img for when users want to program both. The HSS is not to be programmed in this way (see comment on adding the HSS package for more detail). |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
|
||
source ./FLASH_CONFIG.CONF | ||
|
||
./Program_HSS_to_eNVM.sh | ||
./Program_UBOOT_to_eMMC.sh | ||
|
||
echo "reset" > $UART_DEVICE | ||
|
||
./Program_LINUX_to_eMMC.sh |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please rename file - remove capitalisation. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does "program_hss.sh" fits? |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
source ./FLASH_CONFIG.CONF | ||
make -C $BUILDROOT_DIRECTORY/output/build/hart-software-services-next program |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please rename file - remove capitalisation. Is it necessary to do the programming of the device this way? Can you use the full sdcard.img to program the board with U-Boot/kernel/linux image combined. If necessary to stick to this method please enhance this script. It should use expect to send commands over UART instead of using echo as there is no error catching with this method and it will just blindly echo commands to the console, with no guarantee that they did what they were supposed to do. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/bash | ||
|
||
source ./FLASH_CONFIG.CONF | ||
|
||
stty -F $UART_DEVICE 115200 cs8 -cstopb -parenb raw | ||
|
||
printf "\t\n ***** WAITING FOR UBOOT *****" | ||
|
||
( | ||
while test "${key}" != "SundanceDSP" | ||
do | ||
read -r uart | ||
key=`echo $uart | grep "Model: SundanceDSP Polarberry" | awk '{print $2}'` | ||
# echo $uart | ||
done | ||
) < $UART_DEVICE | ||
|
||
printf "\t\n ***** GOT THE TIMEOUT STRING FROM UBOOT *****" | ||
sleep 1 | ||
echo ".\n" > $UART_DEVICE | ||
printf "\t\n ***** Starting programming linux image to the POLARBERRY board *****" | ||
echo "setenv ipaddr $DEVICE_IP" > $UART_DEVICE | ||
echo "setenv serverip $PC_IP" > $UART_DEVICE | ||
echo "setenv bootfile $IMAGE_NAME" > $UART_DEVICE | ||
echo "run flash_linux" > $UART_DEVICE | ||
sleep 1 | ||
|
||
( | ||
while test "${key}" != "MMC" | ||
do | ||
read -r uart | ||
key=`echo $uart | grep "MMC write" | awk '{print $1}'` | ||
# echo $uart | ||
done | ||
) < $UART_DEVICE | ||
|
||
printf "\t\n ***** Programming LINUX to the eMMC of the POLARBERRY board is DONE!!! *****" |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comments as linux programming script. Rather you use the generated sdcard.img, if not, please rename and make use of expect. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/bash | ||
|
||
source ./FLASH_CONFIG.CONF | ||
|
||
stty -F $UART_DEVICE 115200 cs8 -cstopb -parenb raw | ||
|
||
printf "\t\n ***** WAITING FOR HSS *****" | ||
|
||
( | ||
while test "${key}" != "Timeout" | ||
do | ||
read -r uart | ||
key=`echo $uart | grep Timeout | awk '{print $1}'` | ||
done | ||
) < $UART_DEVICE | ||
|
||
printf "\t\n ***** GOT THE TIMEOUT STRING *****" | ||
|
||
echo "" > $UART_DEVICE | ||
printf "\t\n Starting \"ymodem\" command" | ||
echo "ymodem" > $UART_DEVICE | ||
sleep 1 | ||
printf "\t\n Starting init eMMC command" | ||
echo "2" > $UART_DEVICE | ||
sleep 1 | ||
printf "\t\n Starting ymodem receiving command\n" | ||
echo "3" > $UART_DEVICE | ||
sleep 1 | ||
|
||
sz -b --ymodem $BUILDROOT_DIRECTORY/output/images/payload.bin > $UART_DEVICE < $UART_DEVICE | ||
|
||
printf "\t\n Saving the UBOOT to the eMMC memory" | ||
echo "5" > $UART_DEVICE | ||
sleep 2 | ||
echo "6" > $UART_DEVICE | ||
sleep 1 | ||
printf "\t\n ***** Programming U-BOOT to the eMMC of the POLARBERRY board is DONE!!! *****" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
After that in the directory "/home/promwad/microchip_buildroot/buildroot-external-microchip/board/microchip/polarberry" you can find script for board flashing. | ||
|
||
There are 4 scipts: | ||
1) Program_HSS_to_eNVM.sh | ||
2) Program_UBOOT_to_eMMC.sh | ||
3) Program_LINUX_to_eNVM.sh | ||
4) Program_ALL_to_Polarberry.sh | ||
|
||
and settings file: FLASH_CONFIG.CONF | ||
|
||
Script is used to burn images to the Polarberry board. | ||
|
||
The 1th is used to program ONLY HSS bootloader umage to the Polarberry board. | ||
The 2th is used to program ONLY UBOOT image to the Polarberry board. | ||
The 3th is used to program ONLY LINUX (Kernel and root filesystem, bith) image to the Polarberry board. | ||
The 4th is used to program ALL (HSS, UBOOT, LINUX) images to the Polarberry oard. | ||
|
||
|
||
The 1th script can be used with virgin Polarberry boards and requires ONLY JTAG connection with the board. | ||
The 2th script can be used only after 1th was used (it means UBOOT programming requires HSS was installed before) | ||
and requires JTAG and UART connection with the board. | ||
The 3th script can be used only after 2th was used (it means Linux programming requires UBOOT (as HSS toot) | ||
was installed before) and requires JTAG, UART and ETHERNET connection with the board. | ||
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 | ||
UART and ETHERNET connection with the board. Can be used with virgin Polarberry boards too. | ||
|
||
Before script can be used, you need to fix values in FLASH_CONFIG.CONF according to your PC. | ||
The file contains strings with comments, so you can advice what you need: | ||
|
||
BUILDROOT_DIRECTORY - here you need to set PATH to the buildroot you are using | ||
UART_DEVICE - here you need to set the name of the UART in your system. (/dev/ttyUSB1 for example) | ||
DEVICE_IP - here you need to set IP ADDRESS that will be set on the board during flashing. | ||
It shall be one of the free/unused IP addresses from you network. | ||
|
||
PC_IP - here you need to set IP ADDRESS of the PC you are using. (It can be obtained via "ifconfig" command) | ||
IMAGE_NAME - here you need to set file name with LINUX image that is placed on the TFTP server | ||
(default value is "fitimage_polarberry.itb", and this file is built by buildroot and placed in "output/images" directory) | ||
|
||
|
||
To start building images via buildroot you need to run this command in buildrood sources: | ||
1) "make sundancedsp_polarberry_defconfig BR2_EXTERNAL=../buildroot-external-microchip" | ||
(where BR2_EXTERNAL shall point to the mbuildroot microsemi sources). | ||
|
||
2) "make" | ||
Building will take time. Succesfull building will finish like this: | ||
|
||
FIT description: Linux fitImage for Polaberry | ||
Created: Wed Nov 22 05:06:16 2023 | ||
Image 0 (kernel-0) | ||
Description: Linux Kernel | ||
Created: Wed Nov 22 05:06:16 2023 | ||
Type: Kernel Image | ||
Compression: uncompressed | ||
Data Size: 17612800 Bytes = 17200.00 KiB = 16.80 MiB | ||
Architecture: RISC-V | ||
OS: Linux | ||
Load Address: 0x80200000 | ||
Entry Point: 0x80200000 | ||
Hash algo: sha256 | ||
Hash value: 466f36e4c778103ce7ef2fa9dc3456cb1e25d291fe71ab96f3d88ac588004f11 | ||
Image 1 (fdt-0) | ||
Description: Flattened Device Tree blob | ||
Created: Wed Nov 22 05:06:16 2023 | ||
Type: Flat Device Tree | ||
Compression: uncompressed | ||
Data Size: 14949 Bytes = 14.60 KiB = 0.01 MiB | ||
Architecture: RISC-V | ||
Hash algo: sha256 | ||
Hash value: 1ccea6c67588f89a9227a5018b98048390728ef3a21ba90cbd69d8ab750843a4 | ||
Image 2 (ramdisk-0) | ||
Description: ramdisk | ||
Created: Wed Nov 22 05:06:16 2023 | ||
Type: RAMDisk Image | ||
Compression: uncompressed | ||
Data Size: 4921601 Bytes = 4806.25 KiB = 4.69 MiB | ||
Architecture: AArch64 | ||
OS: Linux | ||
Load Address: unavailable | ||
Entry Point: unavailable | ||
Hash algo: sha256 | ||
Hash value: cae144f8a5c8eb441ba01aae3d3dc1c88ea0303afe710e7d7528d04b0e963997 | ||
Default Configuration: 'conf-1' | ||
Configuration 0 (conf-1) | ||
Description: Boot Linux kernel with FDT blob + ramdisk | ||
Kernel: kernel-0 | ||
Init Ramdisk: ramdisk-0 | ||
FDT: fdt-0 | ||
Hash algo: sha256 | ||
Hash value: unavailable | ||
Configuration 1 (conf-2) | ||
Description: Boot Linux kernel with FDT blob | ||
Kernel: kernel-0 | ||
FDT: fdt-0 | ||
Hash algo: sha256 | ||
Hash value: unavailable | ||
|
||
|
||
To flash the images to the Polarberry board: | ||
1) Fix FLASH_CONFIG.CONF file in the board/microchip/polarberry directory. | ||
2) Power ON the Polarberry board | ||
3) run "Program_ALL_to_Polarberry.sh", and wait until all finished. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/dts-v1/; | ||
|
||
/ { | ||
description = "Linux fitImage for Polaberry"; | ||
#address-cells = <1>; | ||
|
||
images { | ||
kernel-0 { | ||
description = "Linux Kernel"; | ||
data = /incbin/("images/Image"); | ||
type = "kernel"; | ||
arch = "riscv"; | ||
os = "linux"; | ||
compression = "none"; | ||
load = <0x80200000>; | ||
entry = <0x80200000>; | ||
hash-1 { | ||
algo = "sha256"; | ||
}; | ||
}; | ||
|
||
fdt-0 { | ||
description = "Flattened Device Tree blob"; | ||
data = /incbin/("images/linux_polarberry.dtb"); | ||
type = "flat_dt"; | ||
arch = "riscv"; | ||
compression = "none"; | ||
hash-1 { | ||
algo = "sha256"; | ||
}; | ||
}; | ||
|
||
ramdisk-0 { | ||
description = "ramdisk"; | ||
data = /incbin/("images/rootfs.cpio.bz2"); | ||
type = "ramdisk"; | ||
arch = "arm64"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. *arch = "riscv"; |
||
os = "linux"; | ||
compression = "none"; | ||
hash-1 { | ||
algo = "sha256"; | ||
}; | ||
}; | ||
}; | ||
|
||
configurations { | ||
default = "conf-1"; | ||
conf-1 { | ||
description = "Boot Linux kernel with FDT blob + ramdisk"; | ||
kernel = "kernel-0"; | ||
fdt = "fdt-0"; | ||
ramdisk = "ramdisk-0"; | ||
hash-1 { | ||
algo = "sha256"; | ||
}; | ||
}; | ||
conf-2 { | ||
description = "Boot Linux kernel with FDT blob"; | ||
kernel = "kernel-0"; | ||
fdt = "fdt-0"; | ||
hash-1 { | ||
algo = "sha256"; | ||
}; | ||
}; | ||
}; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this line (14).