Skip to content

Commit

Permalink
Merge branch 'esl-epfl:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
JoseCalero authored Sep 12, 2024
2 parents 27f3016 + d862250 commit 5ae626e
Show file tree
Hide file tree
Showing 126 changed files with 5,131 additions and 8,056 deletions.
30 changes: 24 additions & 6 deletions .github/workflows/build-apps-job/build-apps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,39 @@ LONG_R="${RED}==================================================================
LONG_W="${WHITE}================================================================================${RESET}"

# Error vars are not defined if there is problem!
APPS=$(\ls sw/applications/) &&\
APPS_GCC=$(\ls sw/applications/) &&\

# Applications that should only be compiled with GCC
ONLY_GCC="example_cpp"

# Initialize APPS_CLANG with the same content as APPS_GCC
APPS_CLANG="$APPS_GCC"

# Loop through ONLY_GCC to filter out the specified applications from APPS_CLANG
for app in $ONLY_GCC; do
# Remove the app from APPS_CLANG
APPS_CLANG=${APPS_CLANG//$app/}
done

declare -i FAILURES=0 &&\
FAILED='' &&\

echo -e ${LONG_W}
echo -e "Will try building the following apps:${RESET}"
echo -e $APPS | tr " " "\n"
echo -e "----> GCC"
echo -e $APPS_GCC | tr " " "\n"
echo -e "----> CLANG"
echo -e $APPS_CLANG | tr " " "\n"
echo -e ${LONG_W}

if [ -z "$APPS" ]; then
if [ -z "$APPS_GCC" ]; then
echo -e ${LONG_R}
echo -e "${RED}No apps found${RESET}"
echo -e ${LONG_R}
exit 2
fi

for APP in $APPS
for APP in $APPS_GCC
do

# Build the app with GCC
Expand All @@ -44,7 +60,10 @@ do
FAILURES=$(( FAILURES + 1 ))
FAILED="$FAILED(gcc)\t$APP "
fi

done

for APP in $APPS_CLANG
do
# Build the app with Clang
make app-clean
if make app PROJECT=$APP COMPILER=clang ; then
Expand All @@ -58,7 +77,6 @@ do
FAILURES=$(( FAILURES + 1 ))
FAILED="$FAILED(clang)\t$APP "
fi

done


Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sim-apps-job/test_apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class BColors:
# Blacklist of apps to skip
blacklist = [
"example_spi_read",
"example_spi_host_dma_power_gate",
"example_spidma_powergate",
"example_spi_write",
]

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/simulate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ jobs:
conda activate core-v-mini-mcu
make clean-all
sed 's/is_included: "no",/is_included: "yes",/' -i mcu_cfg.hjson
sed 's/num_channels: 0x1,/num_channels: 0x4,/' -i mcu_cfg.hjson
make mcu-gen MEMORY_BANKS=6
python3 .github/workflows/sim-apps-job/test_apps.py
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ run_verif_rtl_log.txt
# ignore the following hw automatically generated files
environment.yml
core-v-mini-mcu.upf
core-v-mini-mcu.dc.upf
tb/tb_util.svh
hw/core-v-mini-mcu/include/core_v_mini_mcu_pkg.sv
hw/core-v-mini-mcu/system_bus.sv
Expand All @@ -40,6 +41,7 @@ hw/fpga/scripts/generate_sram.tcl
# same for the C header file and linker scripts and assembly files
sw/device/lib/crt/crt0.S
sw/device/lib/runtime/core_v_mini_mcu.h
sw/device/lib/runtime/core_v_mini_mcu_memory.h
sw/linker/link.ld
sw/linker/link_flash_exec.ld
sw/linker/link_flash_load.ld
Expand Down
20 changes: 16 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ endif
# Project options are based on the app to be build (default - hello_world)
PROJECT ?= hello_world

LINK_FOLDER ?= $(mkfile_path)/sw/linker

# Linker options are 'on_chip' (default),'flash_load','flash_exec','freertos'
LINKER ?= on_chip

Expand Down Expand Up @@ -111,17 +113,19 @@ mcu-gen:
$(PYTHON) util/mcu_gen.py --config $(X_HEEP_CFG) --cfg_peripherals $(MCU_CFG_PERIPHERALS) --pads_cfg $(PAD_CFG) --outdir hw/core-v-mini-mcu/ --bus $(BUS) --memorybanks $(MEMORY_BANKS) --memorybanks_il $(MEMORY_BANKS_IL) --tpl-sv hw/core-v-mini-mcu/core_v_mini_mcu.sv.tpl
$(PYTHON) util/mcu_gen.py --config $(X_HEEP_CFG) --cfg_peripherals $(MCU_CFG_PERIPHERALS) --pads_cfg $(PAD_CFG) --outdir hw/system/ --bus $(BUS) --memorybanks $(MEMORY_BANKS) --memorybanks_il $(MEMORY_BANKS_IL) --tpl-sv hw/system/x_heep_system.sv.tpl
$(PYTHON) util/mcu_gen.py --config $(X_HEEP_CFG) --cfg_peripherals $(MCU_CFG_PERIPHERALS) --pads_cfg $(PAD_CFG) --outdir sw/device/lib/runtime --cpu $(CPU) --bus $(BUS) --memorybanks $(MEMORY_BANKS) --memorybanks_il $(MEMORY_BANKS_IL) --external_domains $(EXTERNAL_DOMAINS) --header-c sw/device/lib/runtime/core_v_mini_mcu.h.tpl
$(PYTHON) util/mcu_gen.py --config $(X_HEEP_CFG) --cfg_peripherals $(MCU_CFG_PERIPHERALS) --pads_cfg $(PAD_CFG) --outdir sw/linker --bus $(BUS) --memorybanks $(MEMORY_BANKS) --memorybanks_il $(MEMORY_BANKS_IL) --linker_script sw/linker/link.ld.tpl
$(PYTHON) util/mcu_gen.py --config $(X_HEEP_CFG) --cfg_peripherals $(MCU_CFG_PERIPHERALS) --pads_cfg $(PAD_CFG) --outdir sw/device/lib/runtime --cpu $(CPU) --bus $(BUS) --memorybanks $(MEMORY_BANKS) --memorybanks_il $(MEMORY_BANKS_IL) --external_domains $(EXTERNAL_DOMAINS) --header-c sw/device/lib/runtime/core_v_mini_mcu_memory.h.tpl
$(PYTHON) util/mcu_gen.py --config $(X_HEEP_CFG) --cfg_peripherals $(MCU_CFG_PERIPHERALS) --pads_cfg $(PAD_CFG) --outdir $(LINK_FOLDER) --bus $(BUS) --memorybanks $(MEMORY_BANKS) --memorybanks_il $(MEMORY_BANKS_IL) --linker_script $(LINK_FOLDER)/link.ld.tpl
$(PYTHON) util/mcu_gen.py --config $(X_HEEP_CFG) --cfg_peripherals $(MCU_CFG_PERIPHERALS) --pads_cfg $(PAD_CFG) --outdir . --bus $(BUS) --memorybanks $(MEMORY_BANKS) --memorybanks_il $(MEMORY_BANKS_IL) --pkg-sv ./core-v-mini-mcu.upf.tpl
$(PYTHON) util/mcu_gen.py --config $(X_HEEP_CFG) --cfg_peripherals $(MCU_CFG_PERIPHERALS) --pads_cfg $(PAD_CFG) --outdir . --bus $(BUS) --memorybanks $(MEMORY_BANKS) --memorybanks_il $(MEMORY_BANKS_IL) --pkg-sv ./core-v-mini-mcu.dc.upf.tpl
$(PYTHON) util/mcu_gen.py --config $(X_HEEP_CFG) --cfg_peripherals $(MCU_CFG_PERIPHERALS) --pads_cfg $(PAD_CFG) --outdir hw/ip/power_manager/rtl --bus $(BUS) --memorybanks $(MEMORY_BANKS) --memorybanks_il $(MEMORY_BANKS_IL) --external_domains $(EXTERNAL_DOMAINS) --pkg-sv hw/ip/power_manager/data/power_manager.sv.tpl
$(PYTHON) util/mcu_gen.py --config $(X_HEEP_CFG) --cfg_peripherals $(MCU_CFG_PERIPHERALS) --pads_cfg $(PAD_CFG) --outdir hw/ip/power_manager/data --bus $(BUS) --memorybanks $(MEMORY_BANKS) --memorybanks_il $(MEMORY_BANKS_IL) --external_domains $(EXTERNAL_DOMAINS) --pkg-sv hw/ip/power_manager/data/power_manager.hjson.tpl
bash -c "cd hw/ip/power_manager; source power_manager_gen.sh; cd ../../../"
$(PYTHON) util/mcu_gen.py --config $(X_HEEP_CFG) --cfg_peripherals $(MCU_CFG_PERIPHERALS) --pads_cfg $(PAD_CFG) --outdir sw/device/lib/drivers/power_manager --bus $(BUS) --memorybanks $(MEMORY_BANKS) --memorybanks_il $(MEMORY_BANKS_IL) --external_domains $(EXTERNAL_DOMAINS) --pkg-sv sw/device/lib/drivers/power_manager/data/power_manager.h.tpl
$(PYTHON) util/mcu_gen.py --config $(X_HEEP_CFG) --cfg_peripherals $(MCU_CFG_PERIPHERALS) --pads_cfg $(PAD_CFG) --outdir hw/system/pad_control/data --bus $(BUS) --memorybanks $(MEMORY_BANKS) --memorybanks_il $(MEMORY_BANKS_IL) --external_pads $(EXT_PAD_CFG) --pkg-sv hw/system/pad_control/data/pad_control.hjson.tpl
$(PYTHON) util/mcu_gen.py --config $(X_HEEP_CFG) --cfg_peripherals $(MCU_CFG_PERIPHERALS) --pads_cfg $(PAD_CFG) --outdir hw/system/pad_control/rtl --bus $(BUS) --memorybanks $(MEMORY_BANKS) --memorybanks_il $(MEMORY_BANKS_IL) --external_pads $(EXT_PAD_CFG) --pkg-sv hw/system/pad_control/rtl/pad_control.sv.tpl
bash -c "cd hw/system/pad_control; source pad_control_gen.sh; cd ../../../"
$(PYTHON) util/mcu_gen.py --config $(X_HEEP_CFG) --cfg_peripherals $(MCU_CFG_PERIPHERALS) --pads_cfg $(PAD_CFG) --outdir sw/linker --bus $(BUS) --memorybanks $(MEMORY_BANKS) --memorybanks_il $(MEMORY_BANKS_IL) --linker_script sw/linker/link_flash_exec.ld.tpl
$(PYTHON) util/mcu_gen.py --config $(X_HEEP_CFG) --cfg_peripherals $(MCU_CFG_PERIPHERALS) --pads_cfg $(PAD_CFG) --outdir sw/linker --bus $(BUS) --memorybanks $(MEMORY_BANKS) --memorybanks_il $(MEMORY_BANKS_IL) --linker_script sw/linker/link_flash_load.ld.tpl
$(PYTHON) util/mcu_gen.py --config $(X_HEEP_CFG) --cfg_peripherals $(MCU_CFG_PERIPHERALS) --pads_cfg $(PAD_CFG) --outdir $(LINK_FOLDER) --bus $(BUS) --memorybanks $(MEMORY_BANKS) --memorybanks_il $(MEMORY_BANKS_IL) --linker_script $(LINK_FOLDER)/link_flash_exec.ld.tpl
$(PYTHON) util/mcu_gen.py --config $(X_HEEP_CFG) --cfg_peripherals $(MCU_CFG_PERIPHERALS) --pads_cfg $(PAD_CFG) --outdir $(LINK_FOLDER) --bus $(BUS) --memorybanks $(MEMORY_BANKS) --memorybanks_il $(MEMORY_BANKS_IL) --linker_script $(LINK_FOLDER)/link_flash_load.ld.tpl
$(PYTHON) ./util/structs_periph_gen.py
$(PYTHON) util/mcu_gen.py --config $(X_HEEP_CFG) --cfg_peripherals $(MCU_CFG_PERIPHERALS) --pads_cfg $(PAD_CFG) --outdir hw/fpga/ --bus $(BUS) --memorybanks $(MEMORY_BANKS) --memorybanks_il $(MEMORY_BANKS_IL) --tpl-sv hw/fpga/sram_wrapper.sv.tpl
$(PYTHON) util/mcu_gen.py --config $(X_HEEP_CFG) --cfg_peripherals $(MCU_CFG_PERIPHERALS) --pads_cfg $(PAD_CFG) --outdir hw/fpga/scripts/ --bus $(BUS) --memorybanks $(MEMORY_BANKS) --memorybanks_il $(MEMORY_BANKS_IL) --tpl-sv hw/fpga/scripts/generate_sram.tcl.tpl
Expand All @@ -146,7 +150,15 @@ verible:
## @param COMPILER_PREFIX=riscv32-unknown-(default)
## @param ARCH=rv32imc(default), <any RISC-V ISA string supported by the CPU>
app: clean-app
$(MAKE) -C sw PROJECT=$(PROJECT) TARGET=$(TARGET) LINKER=$(LINKER) COMPILER=$(COMPILER) COMPILER_PREFIX=$(COMPILER_PREFIX) ARCH=$(ARCH) SOURCE=$(SOURCE)
$(MAKE) -C sw PROJECT=$(PROJECT) TARGET=$(TARGET) LINKER=$(LINKER) LINK_FOLDER=$(LINK_FOLDER) COMPILER=$(COMPILER) COMPILER_PREFIX=$(COMPILER_PREFIX) ARCH=$(ARCH) SOURCE=$(SOURCE) \
|| { \
echo "\033[0;31mHmmm... seems like the compilation failed...\033[0m"; \
echo "\033[0;31mIf you do not understand why, it is likely that you either:\033[0m"; \
echo "\033[0;31m a) offended the Leprechaun of Electronics\033[0m"; \
echo "\033[0;31m b) forgot to run make mcu-gen\033[0m"; \
echo "\033[0;31mI would start by checking b) if I were you!\033[0m"; \
exit 1; \
}

## Just list the different application names available
app-list:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ and you can focus on building your special HW supported by the microcontroller.

The block diagram below shows the `X-HEEP` MCU

<p align="center"><img src="block_diagrams/core_v_mini_mcu.svg" width="650"></p>
<p align="center"><img src="docs/source/images/xheep_diagram.png" width="1000"></p>


> :bookmark_tabs: Please refer to the documentation in [Read the Docs](https://x-heep.readthedocs.io/en/latest/index.html)
Expand Down
Loading

0 comments on commit 5ae626e

Please sign in to comment.