Skip to content
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

[do not merge] rhealstone benchmark #1240

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions _projects/sparcv8leon-generic-qemu/board_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@

/* Timers */

#define TIMER0_CNT 2
#define TIMER1_CNT 0
#define TIMER0_1_IRQ 6
#define TIMER0_2_IRQ 7
#define GPTIMER0_BASE ((void *)0x80000300)
Expand Down
10 changes: 7 additions & 3 deletions _projects/sparcv8leon-gr712rc-board/board_config.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Phoenix-RTOS
*
* Board config for sparcv8leon-gr712-rc
* Board config for sparcv8leon-gr712rc-board
*
* Copyright 2023 Phoenix Systems
* Author: Lukasz Leczkowski
Expand Down Expand Up @@ -80,8 +80,6 @@

/* Timers */

#define TIMER0_CNT 4
#define TIMER1_CNT 2
#define TIMER0_1_IRQ 8
#define TIMER0_2_IRQ 9
#define GPTIMER0_BASE ((void *)0x80000300)
Expand Down Expand Up @@ -127,5 +125,11 @@

#define DMA_MAX_CNT 0

/* Flash */

#define ADDR_FLASH 0x00000000

#define FTMCTRL_BASE 0x80000000


#endif
2 changes: 0 additions & 2 deletions _projects/sparcv8leon-gr716-mimas/board_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@

/* Timers */

#define TIMER0_CNT 7
#define TIMER1_CNT 7
#define TIMER0_1_IRQ 9
#define TIMER0_2_IRQ 10
#define GPTIMER0_BASE ((void *)0x80003000)
Expand Down
2 changes: 0 additions & 2 deletions _projects/sparcv8leon-gr716-mini/board_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@

/* Timers */

#define TIMER0_CNT 7
#define TIMER1_CNT 7
#define TIMER0_1_IRQ 9
#define TIMER0_2_IRQ 10
#define GPTIMER0_BASE ((void *)0x80003000)
Expand Down
162 changes: 162 additions & 0 deletions _projects/sparcv8leon-gr740-mini/board_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
/*
* Phoenix-RTOS
*
* Board config for sparcv8leon-gr740-mini
*
* Copyright 2024 Phoenix Systems
* Author: Lukasz Leczkowski
*
* This file is part of Phoenix-RTOS.
*
* %LICENSE%
*/

#ifndef _BOARD_CONFIG_H_
#define _BOARD_CONFIG_H_

/* CPU Configuration */

#define LEON_HAS_L2CACHE

#define SYSCLK_FREQ (250 * 1000 * 1000) /* MHz */

#define UART_MAX_CNT 2

#define UART_BAUDRATE 115200

#define UART0_BASE ((void *)0xff900000)
#define UART1_BASE ((void *)0xff901000)
#define UART2_BASE ((void *)-1)
#define UART3_BASE ((void *)-1)
#define UART4_BASE ((void *)-1)
#define UART5_BASE ((void *)-1)

#define UART0_IRQ 29
#define UART1_IRQ 30
#define UART2_IRQ -1
#define UART3_IRQ -1
#define UART4_IRQ -1
#define UART5_IRQ -1

#define UART0_TX 21
#define UART0_RX 9

#define UART1_TX 20
#define UART1_RX 8

#define UART2_TX -1
#define UART2_RX -1

#define UART3_TX -1
#define UART3_RX -1

#define UART4_TX -1
#define UART4_RX -1

#define UART5_TX -1
#define UART5_RX -1

#define UART0_ACTIVE 1
#define UART1_ACTIVE 0
#define UART2_ACTIVE 0
#define UART3_ACTIVE 0
#define UART4_ACTIVE 0
#define UART5_ACTIVE 0

#define UART0_DMA 0
#define UART1_DMA 0
#define UART2_DMA 0
#define UART3_DMA 0
#define UART4_DMA 0
#define UART5_DMA 0

#define UART_CONSOLE_PLO 0
#define UART_CONSOLE_KERNEL 0
#define UART_CONSOLE_USER 0

#define GPIO_DIR_IN 0
#define GPIO_DIR_OUT 1

/* Interrupts */

#define INT_CTRL_BASE ((void *)0xff904000)
#define EXTENDED_IRQN 10

/* Timers */

#define TIMER0_1_IRQ 1
#define TIMER0_2_IRQ 2
#define GPTIMER0_BASE ((void *)0xff908000)
#define GPTIMER1_BASE ((void *)0xff909000)

/* ADC */

#define ADC_CNT 0

#define ADC0_ACTIVE 0
#define ADC1_ACTIVE 0
#define ADC2_ACTIVE 0
#define ADC3_ACTIVE 0
#define ADC4_ACTIVE 0
#define ADC5_ACTIVE 0
#define ADC6_ACTIVE 0
#define ADC7_ACTIVE 0

/* SPI */

#define SPI_CNT 1

/* GPIO */

#define GPIO_PORT_CNT 2

/* SpaceWire */

#define SPW_CNT 0

#define SPW0_ACTIVE 0
#define SPW1_ACTIVE 0
#define SPW2_ACTIVE 0
#define SPW3_ACTIVE 0
#define SPW4_ACTIVE 0
#define SPW5_ACTIVE 0

/* SMP */

#define TLB_IRQ 12

/* DMA */

#define DMA_MAX_CNT 0

/* SDRAM configuration */

#define SDCFG1_TRP 0 /* Effective 2 */
#define SDCFG1_TCAS 0 /* Effective 2 */
#define SDCFG1_TRFC 4 /* Effective 7 */

/* Configuration for IS42S1632F on GR740-MINI */
#define SDCFG1_BANKSZ 5
#define SDCFG1_COLSZ 2
#define SDCFG1_RFLOAD 780 /* For 100 MHz SDRAM clock */

#define SDCFG2_EN2T 1
#define SDCFG2_DCS 1
#define SDCFG2_BPARK 1

/* PROM configuration for S29GL01GT11DHV023 flash */

#define MCFG1_VAL 0x00000022 /* 32 R/W waitstates (128ns @ 250MHz) */
#define MCFG3_VAL 0x0
#define MCFG5_VAL 0x00000180 /* 3 lead out cycles (12ns @ 250MHz) */
#define MCFG7_VAL 0x0

#define ADDR_FLASH 0xc0000000

#define FTMCTRL_BASE 0xff903000


#define RAM_ADDR 0x07000000

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[clang-format-pr] reported by reviewdog 🐶
suggested fix

Suggested change
#define RAM_ADDR 0x07000000
#define RAM_ADDR 0x07000000

#define RAM_BANK_SIZE 0x01000000

#endif
18 changes: 18 additions & 0 deletions _projects/sparcv8leon-gr740-mini/build.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
#
# Shell script for building sparcv8leon-gr740-mini project
#
# Copyright 2024 Phoenix Systems
# Author: Lukasz Leczkowski
#

[ "${BASH_SOURCE[0]}" -ef "$0" ] && echo "You should source this script, not execute it!" && exit 1


FLASH_SZ=$((0x8000000))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [shellcheck] reported by reviewdog 🐶
FLASH_SZ appears unused. Verify use (or export if used externally). SC2034

ROOTFS_SZ=$((0x800000))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [shellcheck] reported by reviewdog 🐶
ROOTFS_SZ appears unused. Verify use (or export if used externally). SC2034



b_image_project () {
b_log "The images have been built for the ${TARGET} platform"
}
6 changes: 6 additions & 0 deletions _projects/sparcv8leon-gr740-mini/rootfs-overlay/etc/rc.psh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
:{}:
export PATH=/bin:/sbin:/usr/bin:/usr/sbin
export HOME=/root
W /bin/bind devfs /dev
X /bin/posixsrv
X /bin/psh
21 changes: 13 additions & 8 deletions _targets/sparcv8leon/gr712rc/build.project
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,8 @@ export PORTS_CURL=n
#
export SIZE_PAGE=$((0x1000))

export BOOT_DEVICE="flash0" # Default boot device
export BOOT_DEVICE="flash0" # Default boot device
export MAGIC_USER_SCRIPT="dabaabad" # User script magic value
#TODO: move to nvm.yaml
ERASE_SIZE=$((0x20000)) # Rootfs disk erase block size (in bytes)


b_build_project() {
Expand Down Expand Up @@ -63,10 +61,11 @@ b_image_target() {

ROOTFS="$PREFIX_BOOT/rootfs.jffs2"

local erase_sz=$(image_builder.py query --nvm "$NVM_CONFIG" '{{ nvm.flash0._meta.block_size }}')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [shellcheck] reported by reviewdog 🐶
Declare and assign separately to avoid masking return values. SC2155

# Create jffs2 image with padding at the end of the final erase block, no cleanmarkers (are written by PLO)
mkfs.jffs2 -U -b -m none -e "$ERASE_SIZE" -s "$SIZE_PAGE" -r "$PREFIX_ROOTFS/" -o "$ROOTFS" -p -n
mkfs.jffs2 -U -b -m none -e "$erase_sz" -s "$SIZE_PAGE" -r "$PREFIX_ROOTFS/" -o "$ROOTFS" -p -n

if sumtool -n -e "$ERASE_SIZE" -b -i "$ROOTFS" -o "$ROOTFS.tmp" 2> /dev/null; then
if sumtool -n -e "$erase_sz" -b -i "$ROOTFS" -o "$ROOTFS.tmp" 2> /dev/null; then
echo "JFFS2 Summary nodes created"
mv "$ROOTFS.tmp" "$ROOTFS"
fi
Expand All @@ -76,13 +75,19 @@ b_image_target() {

local FS_SZ
FS_SZ=$(image_builder.py query --nvm "$NVM_CONFIG" '{{ nvm.flash0.rootfs.size }}')
sz=$(du -k "$ROOTFS" | awk '{ print $1 }')
echo "rootfs size: ${sz} kB / $((FS_SZ / 1024)) kB"

local sz
sz=$(du -b "$ROOTFS" | awk '{ print $1 }')
echo "rootfs size: $((sz / 1024)) kB / $((FS_SZ / 1024)) kB"
[ "$sz" -gt "$FS_SZ" ] && b_die "rootfs size exceeds the target partition!"

local start=$(((FS_OFFS+sz+erase_sz-1)/erase_sz)) # Start clean block after rootfs
local end=$(((FS_OFFS+FS_SZ+erase_sz-1)/erase_sz)) # Number of blocks up to rootfs end
local nblocks=$((end-start-1)) # Clean blocks

# cmd for creating cleanmarkers in plo
echo "Format jffs2 partition in plo:"
echo "jffs2 -d 2.0 -c $((FS_OFFS / ERASE_SIZE)):$((FS_SZ / ERASE_SIZE)):${ERASE_SIZE}:16"
echo "jffs2 -d 2.0 -c ${start}:${nblocks}:${erase_sz}:16"

image_builder.py ptable --nvm "$NVM_CONFIG"
image_builder.py -v disk --nvm "$NVM_CONFIG" --part "rootfs=$ROOTFS" --part "plo=${PREFIX_PROG_STRIPPED}plo-${TARGET_FAMILY}-${TARGET_SUBFAMILY}.img"
Expand Down
3 changes: 1 addition & 2 deletions _targets/sparcv8leon/gr712rc/nvm.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
flash0:
size: 0x1000000 # 16 MB
block_size: 0x1000
# eraseblock_size: 0x20000 # TODO: add generic support?
block_size: 0x20000
padding_byte: 0xff
partitions:
- name: plo
Expand Down
3 changes: 1 addition & 2 deletions _targets/sparcv8leon/gr712rc/preinit.plo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ size: 0x1000
is_relative: False

contents:
#FIXME: map should end at 0x7fffffff
- map sram 0x40000000 0x80000000 rwx
- map sram 0x40000000 0x7fffffff rwx
- console 0.0
- phfs uart1 0.1 phoenixd
- phfs flash0 2.0 raw
Expand Down
2 changes: 1 addition & 1 deletion _targets/sparcv8leon/gr712rc/user.plo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ contents:
- kernel {{ env.BOOT_DEVICE }}
- app {{ env.BOOT_DEVICE }} -x dummyfs;-N;devfs;-D sram sram
- app {{ env.BOOT_DEVICE }} -x grlib-multi sram sram
- app {{ env.BOOT_DEVICE }} -x gr712rc-flash;-r;root:jffs2 sram sram
- app {{ env.BOOT_DEVICE }} -x ftmctrl-flash;-r;root:jffs2 sram sram
- app {{ env.BOOT_DEVICE }} -x psh;-i;/etc/rc.psh sram sram
- wait 500
- go!
Loading
Loading