Skip to content

Commit

Permalink
Merge branch 'proposed_master' into fallout_a10_sys_pll_fix
Browse files Browse the repository at this point in the history
  • Loading branch information
alyxazon authored Aug 17, 2023
2 parents 2c3ad89 + 1121d55 commit 4059f32
Show file tree
Hide file tree
Showing 86 changed files with 5,442 additions and 3,036 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
run: make tools-install

- name: Build saftlib
run: make saftlib -j$(nproc)
run: make saftlib

- name: Install saftlib
run: sudo make saftlib-install
11 changes: 7 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
gcc-4.5.3-lm32.tar.xz
lm32-elf-gcc.tar.xz
lm32-gcc-4.5.3.tar.xz
lm32-gcc.tar.xz
riscv_gcc.tar.xz
riscv_gcc.tgz
toolchain/
lm32-toolchain/
riscv-toolchain/
lm32-gcc-4.5.3/
bin/
lib/
tags
Expand Down Expand Up @@ -37,7 +44,3 @@ greybox_tmp
buildid.c
ram.ld
.hdlmake
lm32-gcc-4.5.3.tar.xz
lm32-toolchain
lm32-gcc.tar.xz
lm32-gcc-4.5.3/
44 changes: 39 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ export TLU
ECA=$(PWD)/ip_cores/wr-cores/modules/wr_eca
export ECA
PATH:=$(PWD)/lm32-toolchain/bin:$(PATH)
export PATH
CROSS_COMPILE_RISCV:="$(PWD)/riscv-toolchain/bin/riscv32-elf-"
export CROSS_COMPILE_RISCV
EB_TOOLS_WRPC_SW=no
export EB_TOOLS_WRPC_SW

# This is mainly used to sort QSF files. After sorting it adds and deletes a "GIT marker" which will mark the file as changed.
# Additionally all empty lines will be removed.
Expand Down Expand Up @@ -86,7 +91,7 @@ define ldconfig_note
@echo "***************************************************************************"
endef

all: hdlmake_install etherbone tools sdbfs lm32-toolchain firmware
all: hdlmake_install etherbone tools sdbfs lm32-toolchain riscv-toolchain firmware

gateware: all pexarria5 exploder5 vetar2a vetar2a-ee-butis scu2 scu3 pmc microtca pexp

Expand Down Expand Up @@ -202,28 +207,45 @@ lm32-toolchain: lm32-toolchain-download
lm32-toolchain-clean::
rm -rf lm32-toolchain

riscv-toolchain-download:
test -f riscv_gcc.tgz || wget https://ohwr.org/project/wrpc-sw/wikis/uploads/9f9224d2249848ed3e854636de9c08dc/riscv-11.2-small.tgz -O riscv_gcc.tgz

riscv-toolchain: riscv-toolchain-download
test -d riscv-toolchain || tar zxvf riscv_gcc.tgz -o
test -d riscv-11.2-small && mv riscv-11.2-small riscv-toolchain || true

lm32-cluster-testbench-run:: lm32-toolchain hdlmake_install
make -C testbench/lm32_cluster/test run

lm32-cluster-testbench-clean:: lm32-toolchain hdlmake_install
make -C testbench/lm32_cluster/test clean

riscv-toolchain-clean::
rm -rf riscv_gcc.tgz || true
rm -rf riscv-toolchain || true

wrpc-sw-config::
test -s ip_cores/wrpc-sw/.config || \
$(MAKE) -C ip_cores/wrpc-sw/ gsi_defconfig

firmware: sdbfs etherbone lm32-toolchain wrpc-sw-config
firmware: sdbfs etherbone lm32-toolchain riscv-toolchain wrpc-sw-config
ifeq ($(UNAME), x86_64)
$(MAKE) -C ip_cores/wrpc-sw SDBFS=$(PWD)/ip_cores/fpga-config-space/sdbfs/userspace all
else
@echo "Info: Skipping WRPC-SW build (LM32 toolchain does not support your architecture)..."
@echo "Skipping WRPC-SW build (LM32/RISCV toolchain does not support your architecture)..."
endif

firmware-clean:
ifeq ($(UNAME), x86_64)
$(MAKE) -C ip_cores/wrpc-sw SDBFS=$(PWD)/ip_cores/fpga-config-space/sdbfs/userspace clean
endif

# Debug print
debug:
echo $$PATH
echo $$EXTRA_FLAGS
echo $$CROSS_COMPILE_RISCV

# #################################################################################################
# Arria 2 devices
# #################################################################################################
Expand Down Expand Up @@ -472,6 +494,18 @@ bg: lm32-toolchain
bg-clean::
$(MAKE) -C modules/burst_generator clean

lm32-example:
$(MAKE) -C modules/lm32-example

lm32-example-clean:
$(MAKE) -C modules/lm32-example clean

lm32-simple-access:
$(MAKE) -C modules/lm32-example TARGET=simpleAccess

lm32-simple-access-clean:
$(MAKE) -C modules/lm32-example clean TARGET=simpleAccess

# #################################################################################################
# Legacy and unmaintained devices
# #################################################################################################
Expand All @@ -495,10 +529,10 @@ exploder-clean::
$(MAKE) -C syn/gsi_exploder/wr_core_demo clean

pexarria10_soc:: firmware
$(MAKE) -C syn/gsi_pexarria10_soc/control PATH=$(PWD)/lm-32toolchain/bin:$(PATH) all
$(MAKE) -C syn/gsi_pexarria10_soc/control PATH=$(PWD)/lm32-toolchain/bin:$(PATH) all

pexarria10_soc-clean::
$(MAKE) -C syn/gsi_pexarria10_soc/control PATH=$(PWD)/lm-32toolchain/bin:$(PATH) clean
$(MAKE) -C syn/gsi_pexarria10_soc/control PATH=$(PWD)/lm32-toolchain/bin:$(PATH) clean

# We need to run ./fix-git.sh and ./install-hdlmake.sh: make them a prerequisite for Makefile
Makefile: prereq-rule
Expand Down
2 changes: 1 addition & 1 deletion fix-git.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if false; then

# use explicit names instead
else
for d in ip_cores/wrpc-sw ip_cores/fpga-config-space; do
for d in ip_cores/wrpc-sw ip_cores/wr-cores ip_cores/fpga-config-space; do
(cd $d && do_submod)
done
fi
2 changes: 1 addition & 1 deletion ip_cores/fpga-config-space
Submodule fpga-config-space updated from 4f853d to b2dcb1
2 changes: 1 addition & 1 deletion ip_cores/general-cores
Submodule general-cores updated from 78020e to a637d4
2 changes: 1 addition & 1 deletion ip_cores/wr-cores
Submodule wr-cores updated from 48f04c to abaca8
2 changes: 1 addition & 1 deletion ip_cores/wrpc-sw
Submodule wrpc-sw updated from aef359 to f7851e
4 changes: 2 additions & 2 deletions modules/common-libs/fw/common-fwlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,9 @@ b2bt_t fwlib_tfns2tps(float t_ns)


float fwlib_tps2tfns(b2bt_t t_ps)
{
{
float tmp1, tmp2;

tmp1 = (float)(t_ps.ns);
tmp2 = (float)(t_ps.ps) / 1000.0;

Expand Down
21 changes: 12 additions & 9 deletions modules/lm32-example/miniExample.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* version : 05-Jun-2020
*
* very basic example program for lm32 softcore on GSI timing receivers
*
*
* -------------------------------------------------------------------------------------------
* License Agreement for this software:
*
Expand All @@ -27,7 +27,7 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
Expand All @@ -41,14 +41,14 @@
#include <inttypes.h>
#include <stdint.h>

// includes specific for bel_projects
// includes specific for bel_projects
#include "pp-printf.h"
#include "mini_sdb.h"
#include "aux.h"
#include "dbg.h"
#include "uart.h"

// shared memory map for communication via Wishbone
// shared memory map for communication via Wishbone
#include "miniExample_shared_mmap.h"

// stuff required for environment
Expand All @@ -59,22 +59,25 @@ uint64_t SHARED dummy = 0;

void init(){
discoverPeriphery(); // mini-sdb: get info on important Wishbone infrastructure
uart_init_hw(); // init UART, required for printf...
cpuId = getCpuIdx(); // get ID of THIS CPU
uart_init_hw(); // init UART, required for printf...
cpuId = getCpuIdx(); // get ID of THIS CPU
} // init

void main(void) {
int main(void) {
int j;

init();

// wait 1 second and print initial message to UART
// pro tip: try 'eb-console' to view printed messages
for (j = 0; j < (31000000); ++j) { asm("nop"); } // 31.25 x 'asm("nop")' operations take 1 us; handmade sleep

pp_printf("Hello World!\n");

while (1) {
pp_printf("boring...\n");
uwait(1000000); // alternative to handmade sleep using the wb_timer for lm32
} // while

return 0;
} // main
47 changes: 47 additions & 0 deletions modules/lm32-example/simpleAccess.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// Build and test
// make lm32-simple-access-clean && make lm32-simple-access && lm32-elf-objdump -D modules/lm32-example/simpleAccess.elf > dis && eb-fwload -v dev/ttyUSB0 u 0x0 modules/lm32-example/simpleAccess.bin

#include <stdio.h>
#include <string.h>
#include <inttypes.h>
#include <stdint.h>
#include "mini_sdb.h"
#include "pp-printf.h"
#include "uart.h"

#define LVDS_OE_ON_OFFSET (0x300>>2)
#define LVDS_OE_OFF_OFFSET (0x308>>2)
#define ALL_BITS 0xffffffff
#define LOOP_CNT 1000000

void loop(void);

void loop(void)
{
volatile uint32_t cnt = 0;
for (cnt = 0; cnt < LOOP_CNT; ++cnt) { asm("nop"); }
}

int main(void)
{
volatile uint32_t *pGPIO_on = NULL;
volatile uint32_t *pGPIO_off = NULL;

discoverPeriphery();
uart_init_hw();

pGPIO_on = pIOC+LVDS_OE_ON_OFFSET;
pGPIO_off = pIOC+LVDS_OE_OFF_OFFSET;

pp_printf("GPIO Base: 0x%x 0x%x 0x%x\n", pIOC, pGPIO_on, pGPIO_off);

while(1)
{
*pGPIO_on = ALL_BITS;
loop();
*pGPIO_off = ALL_BITS;
loop();
}

return 0;
}
Loading

0 comments on commit 4059f32

Please sign in to comment.