├── apps └── .gitkeep ├── bench └── .gitkeep ├── nortos ├── memscan │ ├── .gitignore │ ├── system_metal_conf.h │ ├── memscan.c │ └── Makefile ├── setjmp │ ├── .gitignore │ ├── system_metal_conf.h │ ├── setjmptest.c │ └── Makefile ├── hello_world │ ├── .gitignore │ ├── system_metal_conf.h │ ├── helloworld.c │ └── Makefile ├── README.md └── .clang-format ├── tests ├── spi │ ├── .gitignore │ └── LICENSE ├── timer │ └── .gitignore ├── uart │ ├── .gitignore │ ├── waves.tcl │ └── Makefile ├── i2c_eeprom │ ├── .gitignore │ └── Makefile ├── i2c_scan │ ├── .gitignore │ └── Makefile ├── streambufferisr │ ├── .gitignore │ └── Makefile ├── hello_world_pmsis │ └── .gitignore ├── cluster │ └── cluster_fork │ │ ├── .gitignore │ │ └── Makefile ├── .clang-format ├── queue │ └── Makefile └── semaphore │ └── Makefile ├── drivers ├── README.md ├── include │ ├── stdout.h │ ├── timer_irq.h │ ├── clkdiv.h │ ├── pinmux.h │ ├── fc_event.h │ ├── udma_spim.h │ ├── device.h │ ├── freq.h │ ├── udma_core.h │ ├── pi_errno.h │ ├── debug.h │ ├── implementation_specific_defines.h │ ├── soc_eu_metal.h │ ├── bits.h │ └── cluster │ │ └── cl_idma_archi.h ├── clkconst.c ├── soc_eu.c ├── device.c ├── pinmux.c ├── makefile.mk ├── timer_irq.c └── fc_event.c ├── template ├── hello_world │ ├── .gitignore │ ├── system_metal_conf.h │ ├── helloworld.c │ ├── .clang-format │ └── Makefile └── blinky │ ├── .gitignore │ ├── README.md │ ├── .clang-format │ └── Makefile ├── env ├── rtl.sh ├── fpga.sh ├── default-config.sh ├── core-v-mcu.sh ├── gap8.sh ├── mrwolf.sh ├── pulp.sh ├── control-pulp-fpga.sh ├── pulpissimo-ri5cy.sh ├── pulpissimo-cv32e40p.sh └── control-pulp.sh ├── support ├── install │ └── .gitignore ├── README.md ├── gwrap.py └── egvsoc.sh ├── demos ├── README.md └── shared │ ├── Minimal │ └── readme.txt │ └── include │ ├── flash.h │ ├── flop.h │ ├── mevents.h │ ├── AbortDelay.h │ ├── BlockQ.h │ ├── PollQ.h │ ├── blocktim.h │ ├── death.h │ ├── semtest.h │ ├── recmutex.h │ ├── QPeek.h │ ├── countsem.h │ ├── integer.h │ ├── dynamic.h │ ├── comtest2.h │ ├── print.h │ ├── StaticAllocation.h │ ├── comtest_strings.h │ ├── TaskNotify.h │ ├── GenQTest.h │ ├── QueueSet.h │ ├── MessageBufferDemo.h │ ├── IntSemTest.h │ ├── fileIO.h │ ├── QueueSetPolling.h │ ├── TimerDemo.h │ ├── QueueOverwrite.h │ ├── StreamBufferDemo.h │ ├── partest.h │ ├── StreamBufferInterrupt.h │ ├── MessageBufferAMP.h │ ├── IntQueue.h │ ├── comtest.h │ ├── crhook.h │ ├── EventGroupsDemo.h │ ├── flash_timer.h │ └── crflash.h ├── target ├── README.md ├── arch │ ├── makefile.mk │ ├── builtins.h │ ├── core_utils.h │ └── io.h ├── pulp │ ├── include │ │ ├── link.h │ │ └── system.h │ ├── makefile.mk │ └── system_metal.c ├── control-pulp │ ├── include │ │ ├── link.h │ │ └── system.h │ ├── makefile.mk │ └── system_metal.c ├── core-v-mcu │ ├── makefile.mk │ ├── include │ │ └── system.h │ └── system_metal.c └── pulpissimo │ ├── makefile.mk │ ├── include │ └── system.h │ └── system_metal.c ├── .gitignore ├── scripts ├── elf-diff-py3.patch ├── install-elf-diff.sh ├── bindiff.sh ├── pulpstim └── README_MEM.md ├── libc ├── pulp_malloc.c ├── makefile.mk └── malloc │ ├── fc_l1_malloc.c │ └── l2_malloc.c ├── .gitmodules ├── Makefile ├── .clang-format └── default_srcs.mk /apps/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /bench/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /nortos/memscan/.gitignore: -------------------------------------------------------------------------------- 1 | memscan -------------------------------------------------------------------------------- /tests/spi/.gitignore: -------------------------------------------------------------------------------- 1 | spi_test 2 | -------------------------------------------------------------------------------- /tests/timer/.gitignore: -------------------------------------------------------------------------------- 1 | timer 2 | -------------------------------------------------------------------------------- /tests/uart/.gitignore: -------------------------------------------------------------------------------- 1 | uart_test -------------------------------------------------------------------------------- /drivers/README.md: -------------------------------------------------------------------------------- 1 | # Drivers 2 | 3 | 4 | -------------------------------------------------------------------------------- /nortos/setjmp/.gitignore: -------------------------------------------------------------------------------- 1 | setjmptest 2 | -------------------------------------------------------------------------------- /tests/i2c_eeprom/.gitignore: -------------------------------------------------------------------------------- 1 | i2c_eeprom 2 | -------------------------------------------------------------------------------- /tests/i2c_scan/.gitignore: -------------------------------------------------------------------------------- 1 | i2c_scan 2 | 3 | -------------------------------------------------------------------------------- /nortos/hello_world/.gitignore: -------------------------------------------------------------------------------- 1 | helloworld 2 | -------------------------------------------------------------------------------- /template/hello_world/.gitignore: -------------------------------------------------------------------------------- 1 | helloworld 2 | -------------------------------------------------------------------------------- /tests/streambufferisr/.gitignore: -------------------------------------------------------------------------------- 1 | streambufferisr 2 | -------------------------------------------------------------------------------- /tests/hello_world_pmsis/.gitignore: -------------------------------------------------------------------------------- 1 | hello_world_pmsis 2 | -------------------------------------------------------------------------------- /template/blinky/.gitignore: -------------------------------------------------------------------------------- 1 | blinky 2 | sim/ 3 | gvsim/ 4 | *.o 5 | -------------------------------------------------------------------------------- /tests/cluster/cluster_fork/.gitignore: -------------------------------------------------------------------------------- 1 | cluster_fork 2 | *.log 3 | -------------------------------------------------------------------------------- /env/rtl.sh: -------------------------------------------------------------------------------- 1 | # RTL sim specific compilation options. Needs to be sourced last. 2 | -------------------------------------------------------------------------------- /support/install/.gitignore: -------------------------------------------------------------------------------- 1 | bin 2 | include 3 | lib 4 | python 5 | rules 6 | configs 7 | -------------------------------------------------------------------------------- /demos/README.md: -------------------------------------------------------------------------------- 1 | # FreeRTOS Demo 2 | 3 | These FreeRTOS's standard Demos (blinky and full) ported to PULP. 4 | -------------------------------------------------------------------------------- /template/blinky/README.md: -------------------------------------------------------------------------------- 1 | # FreeRTOS Demo 2 | 3 | This is FreeRTOS' standard blinky demo ported to PULP. 4 | -------------------------------------------------------------------------------- /tests/spi/LICENSE: -------------------------------------------------------------------------------- 1 | rtl_config.json is licensed under Apache 2.0. See LICENSE-APACHE-2.0.md in the root folder. 2 | -------------------------------------------------------------------------------- /target/README.md: -------------------------------------------------------------------------------- 1 | # Target 2 | 3 | Target (Chip) specific low-level files such as initialization routines, 4 | linkerscripts, crt0.S etc. 5 | -------------------------------------------------------------------------------- /nortos/README.md: -------------------------------------------------------------------------------- 1 | # No RTOS 2 | 3 | Simple tests that don't rely on FreeRTOS functionality (but still link against 4 | it). Mostly to test newlib stuff. 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.hex 3 | *.lst 4 | *.stim 5 | *.map 6 | *.su 7 | *.veri 8 | *.log 9 | rtosdemo* 10 | gvsim/ 11 | sim/ 12 | sim-*/ 13 | TAGS 14 | __pycache__ 15 | -------------------------------------------------------------------------------- /demos/shared/Minimal/readme.txt: -------------------------------------------------------------------------------- 1 | This directory contains the implementation of the "common demo tasks". These 2 | are test tasks and demo tasks that are used by nearly all the demo applications. -------------------------------------------------------------------------------- /scripts/elf-diff-py3.patch: -------------------------------------------------------------------------------- 1 | diff --git a/bin/elf_diff b/bin/elf_diff 2 | index c8e5ef4..6aa7d69 100755 3 | --- a/bin/elf_diff 4 | +++ b/bin/elf_diff 5 | @@ -1,4 +1,4 @@ 6 | -#!/usr/bin/python 7 | +#!/usr/bin/python3 8 | 9 | # -*- coding: utf-8 -*- 10 | 11 | -------------------------------------------------------------------------------- /env/fpga.sh: -------------------------------------------------------------------------------- 1 | # Generic FPGA specific compilation options. Needs to be sourced last. 2 | 3 | # we don't have fake io on FPGAs 4 | export CONFIG_STDIO=uart 5 | # constant clock sources 6 | export CONFIG_DRIVER_FLL=n 7 | export CONFIG_DRIVER_CLKDIV=n 8 | export CONFIG_DRIVER_CLKCONST=y 9 | -------------------------------------------------------------------------------- /support/README.md: -------------------------------------------------------------------------------- 1 | # Support 2 | Supporting libraries for simulation and more. 3 | 4 | ## Overview 5 | + json-tools: parsing json files 6 | + dpi-models: SystemVerilog DPI models for peripherals. Used in tests. 7 | + pulp-debug-bridge: GDB to Hardware bridge. Translates GDB command into a 8 | language older RI5CY cores understand. 9 | -------------------------------------------------------------------------------- /target/arch/makefile.mk: -------------------------------------------------------------------------------- 1 | # Copyright 2020 ETH Zurich 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # SPDX-License-Identifier: Apache-2.0 16 | # Author: Robert Balas (balasr@iis.ee.ethz.ch) 17 | 18 | CV_CPPFLAGS += -I"$(FREERTOS_PROJ_ROOT)/$(dir)" 19 | -------------------------------------------------------------------------------- /env/default-config.sh: -------------------------------------------------------------------------------- 1 | # default feature settings for compiling programs 2 | 3 | # generic 4 | export CONFIG_FREERTOS_KERNEL=y 5 | export CONFIG_FREERTOS_CHIP_INCLUDE=PULPissimo 6 | export CONFIG_USE_NEWLIB=y 7 | 8 | # stdio 9 | export CONFIG_STDIO=fake 10 | ## uart id to be used for stdio (if enabled) 11 | export CONFIG_STDIO_UART_DEVICE_ID=0 12 | ## uart baudrate (if enabled) 13 | export CONFIG_STDIO_UART_BAUDRATE=115200 14 | ## uart internal copy out buffer size (if enabled) 15 | export CONFIG_STDIO_UART_BUFSIZE=256 16 | 17 | # divers 18 | export CONFIG_DRIVER_FLL=y 19 | export CONFIG_DRIVER_CLKDIV=n 20 | export CONFIG_DRIVER_PLIC=n 21 | export CONFIG_DRIVER_INT=pclint 22 | 23 | # compilation options 24 | export CONFIG_CC_LTO=n 25 | export CONFIG_CC_SANITIZE=n 26 | export CONFIG_CC_STACKDBG=n 27 | export CONFIG_CC_MAXSTACKSIZE=1024 28 | -------------------------------------------------------------------------------- /tests/uart/waves.tcl: -------------------------------------------------------------------------------- 1 | # Copyright 2020 ETH Zurich 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # SPDX-License-Identifier: Apache-2.0 16 | # Author: Robert Balas (balasr@iis.ee.ethz.ch) 17 | 18 | source waves/software.tcl 19 | source waves/apb_intc.tcl 20 | source waves/apb_soc_ctrl.tcl 21 | source waves/udma_ss.tcl 22 | source waves/soc_peripherals.tcl 23 | -------------------------------------------------------------------------------- /nortos/memscan/system_metal_conf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 ETH Zurich 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * Author: Robert Balas (balasr@iis.ee.ethz.ch) 18 | */ 19 | 20 | #define DEFAULT_SYSTEM_CLOCK 50000000u /* Default System clock value */ 21 | #define configTOTAL_HEAP_SIZE ((size_t)(16 * 1024)) 22 | -------------------------------------------------------------------------------- /nortos/setjmp/system_metal_conf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 ETH Zurich 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * Author: Robert Balas (balasr@iis.ee.ethz.ch) 18 | */ 19 | 20 | #define DEFAULT_SYSTEM_CLOCK 50000000u /* Default System clock value */ 21 | #define configTOTAL_HEAP_SIZE ((size_t)(16 * 1024)) 22 | -------------------------------------------------------------------------------- /nortos/hello_world/system_metal_conf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 ETH Zurich 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * Author: Robert Balas (balasr@iis.ee.ethz.ch) 18 | */ 19 | 20 | #define DEFAULT_SYSTEM_CLOCK 50000000u /* Default System clock value */ 21 | #define configTOTAL_HEAP_SIZE ((size_t)(16 * 1024)) 22 | -------------------------------------------------------------------------------- /template/hello_world/system_metal_conf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 ETH Zurich 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * Author: Robert Balas (balasr@iis.ee.ethz.ch) 18 | */ 19 | 20 | #define DEFAULT_SYSTEM_CLOCK 50000000u /* Default System clock value */ 21 | #define configTOTAL_HEAP_SIZE ((size_t)(16 * 1024)) 22 | -------------------------------------------------------------------------------- /nortos/hello_world/helloworld.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 ETH Zurich 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * Author: Robert Balas (balasr@iis.ee.ethz.ch) 18 | */ 19 | 20 | #include 21 | #include 22 | 23 | int main(int argc, char *argv[]) 24 | { 25 | printf("hello world!\n"); 26 | return EXIT_SUCCESS; 27 | } 28 | -------------------------------------------------------------------------------- /scripts/install-elf-diff.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Copyright 2020 ETH Zurich 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | # SPDX-License-Identifier: Apache-2.0 18 | # Author: Robert Balas (balasr@iis.ee.ethz.ch) 19 | 20 | [[ ! -d elf_diff ]] || { echo "elf_diff is already downloaded. Aborting."; exit 1; } 21 | 22 | git clone git@github.com:bluewww/elf_diff.git 23 | patch -p1 -d elf_diff/ < elf-diff-py3.patch 24 | -------------------------------------------------------------------------------- /target/pulp/include/link.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 ETH Zurich 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | */ 18 | 19 | /* Author: Robert Balas */ 20 | 21 | #define PI_CL_L1 __attribute__((section(".l1cluster_g"))) 22 | #define PI_FC_L1 __attribute__((section(".data"))) 23 | 24 | #define PI_L1 PI_CL_L1 25 | #define FC_L1_MEM PI_FC_L1 26 | -------------------------------------------------------------------------------- /target/control-pulp/include/link.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 ETH Zurich 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | */ 18 | 19 | /* Author: Robert Balas */ 20 | 21 | #define PI_CL_L1 __attribute__((section(".l1cluster_g"))) 22 | #define PI_FC_L1 __attribute__((section(".data"))) 23 | 24 | #define PI_L1 PI_CL_L1 25 | #define FC_L1_MEM PI_FC_L1 26 | -------------------------------------------------------------------------------- /env/core-v-mcu.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Copyright 2021 ETH Zurich 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | # SPDX-License-Identifier: Apache-2.0 18 | # Author: Robert Balas (balasr@iis.ee.ethz.ch) 19 | 20 | # var that points to this project's root 21 | ROOT=$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")/.." && pwd) 22 | export FREERTOS_PROJ_ROOT="$ROOT" 23 | export FREERTOS_CONFIG_FAMILY="core-v-mcu" 24 | 25 | export CONFIG_TARGET="core-v-mcu" 26 | 27 | source "$ROOT/env/default-config.sh" 28 | -------------------------------------------------------------------------------- /env/gap8.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Copyright 2021 ETH Zurich 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | # SPDX-License-Identifier: Apache-2.0 18 | # Author: Robert Balas (balasr@iis.ee.ethz.ch) 19 | 20 | # var that points to this project's root 21 | ROOT=$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")/.." && pwd) 22 | export FREERTOS_PROJ_ROOT="$ROOT" 23 | export FREERTOS_CONFIG_FAMILY="gap8" 24 | 25 | export CONFIG_TARGET="gap8" 26 | 27 | printf "WARNING: gap8 is not properly supported yet\n" 28 | -------------------------------------------------------------------------------- /env/mrwolf.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Copyright 2020 ETH Zurich 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | # SPDX-License-Identifier: Apache-2.0 18 | # Author: Robert Balas (balasr@iis.ee.ethz.ch) 19 | 20 | # var that points to this project's root 21 | ROOT=$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")/.." && pwd) 22 | export FREERTOS_PROJ_ROOT="$ROOT" 23 | export FREERTOS_CONFIG_FAMILY="mrwolf" 24 | 25 | export CONFIG_TARGET="mrwolf" 26 | 27 | printf "WARNING: mrwolf is not properly supported yet\n" 28 | -------------------------------------------------------------------------------- /libc/pulp_malloc.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 ETH Zurich 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * Author: Robert Balas (balasr@iis.ee.ethz.ch) 18 | */ 19 | 20 | /* Malloc for PULP*. We just forward this is newlib's malloc. */ 21 | 22 | #include 23 | 24 | void *pi_l2_malloc(int size) 25 | { 26 | return malloc((size_t)size); 27 | } 28 | 29 | void pi_l2_free(void *chunk, int size) 30 | { 31 | (void)size; 32 | free(chunk); 33 | } 34 | -------------------------------------------------------------------------------- /env/pulp.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Copyright 2020 ETH Zurich 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | # SPDX-License-Identifier: Apache-2.0 18 | # Author: Robert Balas (balasr@iis.ee.ethz.ch) 19 | 20 | # var that points to this project's root 21 | ROOT=$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")/.." && pwd) 22 | export FREERTOS_PROJ_ROOT="$ROOT" 23 | export FREERTOS_CONFIG_FAMILY="pulp" 24 | 25 | export CONFIG_TARGET="pulp" 26 | 27 | source "$ROOT/env/default-config.sh" 28 | 29 | export CONFIG_CLUSTER=y 30 | -------------------------------------------------------------------------------- /target/core-v-mcu/makefile.mk: -------------------------------------------------------------------------------- 1 | # Copyright 2020 ETH Zurich 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # SPDX-License-Identifier: Apache-2.0 16 | # Author: Robert Balas (balasr@iis.ee.ethz.ch) 17 | 18 | SRCS += $(dir)/crt0.S 19 | ifeq ($(CONFIG_FREERTOS_KERNEL),y) 20 | SRCS += $(dir)/system.c 21 | SRCS += $(dir)/vectors.S 22 | else 23 | SRCS += $(dir)/system_metal.c 24 | SRCS += $(dir)/vectors_metal.S 25 | endif 26 | 27 | CV_CPPFLAGS += -I$(FREERTOS_PROJ_ROOT)/$(dir)/include 28 | 29 | CV_LDFLAGS += -T$(FREERTOS_PROJ_ROOT)/$(dir)/link.ld 30 | -------------------------------------------------------------------------------- /target/pulpissimo/makefile.mk: -------------------------------------------------------------------------------- 1 | # Copyright 2020 ETH Zurich 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # SPDX-License-Identifier: Apache-2.0 16 | # Author: Robert Balas (balasr@iis.ee.ethz.ch) 17 | 18 | SRCS += $(dir)/crt0.S 19 | ifeq ($(CONFIG_FREERTOS_KERNEL),y) 20 | SRCS += $(dir)/system.c 21 | SRCS += $(dir)/vectors.S 22 | else 23 | SRCS += $(dir)/system_metal.c 24 | SRCS += $(dir)/vectors_metal.S 25 | endif 26 | 27 | CV_CPPFLAGS += -I$(FREERTOS_PROJ_ROOT)/$(dir)/include 28 | 29 | CV_LDFLAGS += -T$(FREERTOS_PROJ_ROOT)/$(dir)/link.ld 30 | -------------------------------------------------------------------------------- /env/control-pulp-fpga.sh: -------------------------------------------------------------------------------- 1 | # Copyright 2021 ETH Zurich 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # SPDX-License-Identifier: Apache-2.0 16 | # Author: Robert Balas (balasr@iis.ee.ethz.ch) 17 | 18 | # control-pulp fpga implementation 19 | 20 | ROOT=$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")/.." && pwd) 21 | source "$ROOT/env/control-pulp.sh" 22 | 23 | # we don't have fake io on FPGAs 24 | export CONFIG_STDIO=uart 25 | # constant clock sources 26 | export CONFIG_DRIVER_FLL=n 27 | export CONFIG_DRIVER_CLKDIV=n 28 | export CONFIG_DRIVER_CLKCONST=y 29 | -------------------------------------------------------------------------------- /scripts/bindiff.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Copyright 2020 ETH Zurich 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | # SPDX-License-Identifier: Apache-2.0 18 | # Author: Robert Balas (balasr@iis.ee.ethz.ch) 19 | 20 | usage () { 21 | echo "Usage: bindiff elf-a elf-b" 22 | exit 23 | } 24 | [[ -n $RISCV ]] || { echo "RISCV environment variable unset. Please point it to your toolchain."; exit 1; } 25 | [[ -f $1 ]] || usage 26 | [[ -f $2 ]] || usage 27 | scripts/elf_diff/bin/elf_diff --bin_dir "$RISCV/bin" --bin-prefix "riscv32-unknown-elf-" $1 $2 28 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "kernel"] 2 | path = kernel 3 | url = https://github.com/pulp-platform/pulp-freertos-kernel.git 4 | [submodule "common/pmsis_api"] 5 | path = common/pmsis_api 6 | url = https://github.com/GreenWaves-Technologies/pmsis_api.git 7 | [submodule "support/dpi-models"] 8 | path = support/dpi-models 9 | url = https://github.com/pulp-platform/dpi-models.git 10 | [submodule "support/json-tools"] 11 | path = support/json-tools 12 | url = https://github.com/pulp-platform/json-tools.git 13 | [submodule "support/pulp-debug-bridge"] 14 | path = support/pulp-debug-bridge 15 | url = https://github.com/pulp-platform/pulp-debug-bridge.git 16 | [submodule "support/archi"] 17 | path = support/archi 18 | url = https://github.com/pulp-platform/archi.git 19 | [submodule "support/gvsoc"] 20 | path = support/gvsoc 21 | url = https://github.com/pulp-platform/gvsoc.git 22 | [submodule "support/pulp-configs"] 23 | path = support/pulp-configs 24 | url = https://github.com/pulp-platform/pulp-configs.git 25 | [submodule "support/runner"] 26 | path = support/runner 27 | url = https://github.com/pulp-platform/runner.git 28 | -------------------------------------------------------------------------------- /env/pulpissimo-ri5cy.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Copyright 2020 ETH Zurich 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | # SPDX-License-Identifier: Apache-2.0 18 | # Author: Robert Balas (balasr@iis.ee.ethz.ch) 19 | 20 | # var that points to this project's root 21 | ROOT=$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")/.." && pwd) 22 | export FREERTOS_PROJ_ROOT="$ROOT" 23 | export FREERTOS_CONFIG_FAMILY="pulpissimo" 24 | 25 | export CONFIG_TARGET="pulpissimo" 26 | 27 | source "$ROOT/env/default-config.sh" 28 | 29 | export CONFIG_FREERTOS_CHIP_INCLUDE=PULPissimo 30 | 31 | -------------------------------------------------------------------------------- /target/arch/builtins.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 ETH Zurich 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | */ 18 | 19 | #ifndef __BUILTINS_H__ 20 | #define __BUILTINS_H__ 21 | 22 | #ifdef __pulp__ 23 | /* Position of the most significant bit of x */ 24 | #define __FF1(x) __builtin_pulp_ff1((x)) 25 | #define __FL1(x) __builtin_pulp_fl1((x)) 26 | #else 27 | #error FF1 is an unimplemented builtin 28 | #define __FF1(x) 29 | #define __FL1(x) (31 - __builtin_clz((x))) 30 | #endif 31 | 32 | #endif /* __BUILTINS_H__ */ 33 | -------------------------------------------------------------------------------- /env/pulpissimo-cv32e40p.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Copyright 2020 ETH Zurich 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | # SPDX-License-Identifier: Apache-2.0 18 | # Author: Robert Balas (balasr@iis.ee.ethz.ch) 19 | 20 | # var that points to this project's root 21 | ROOT=$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")/.." && pwd) 22 | export FREERTOS_PROJ_ROOT="$ROOT" 23 | export FREERTOS_CONFIG_FAMILY="pulpissimo" 24 | 25 | export CONFIG_TARGET="pulpissimo" 26 | 27 | source "$ROOT/env/default-config.sh" 28 | 29 | export CONFIG_FREERTOS_CHIP_INCLUDE=PULPissimo_CV32E40P 30 | -------------------------------------------------------------------------------- /drivers/include/stdout.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 ETH Zurich and University of Bologna 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | */ 18 | 19 | /* Description: Debug stdout (simulation) memory map 20 | * Authors: Robert Balas (balasr@iis.ee.ethz.ch) 21 | */ 22 | 23 | #ifndef __STDOUT_H__ 24 | #define __STDOUT_H__ 25 | 26 | #define STDOUT_PUTC_OFFSET 0x0 27 | #define STDOUT_OPEN_OFFSET 0x2000 28 | #define STDOUT_OPEN_END_OFFSET 0x3000 29 | #define STDOUT_READ_OFFSET 0x4000 30 | 31 | #endif /* __STDOUT_H__ */ 32 | -------------------------------------------------------------------------------- /drivers/include/timer_irq.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 ETH Zurich and University of Bologna 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | */ 18 | 19 | /* Author: Robert Balas (balasr@iis.ee.ethz.ch) */ 20 | 21 | #ifndef __TIMER_IRQ_H__ 22 | #define __TIMER_IRQ_H__ 23 | #include 24 | 25 | int timer_irq_init(uint32_t ticks); 26 | 27 | int timer_irq_set_timeout(uint32_t ticks, bool idle); 28 | 29 | uint32_t timer_irq_clock_elapsed(); 30 | 31 | uint32_t timer_irq_cycle_get_32(); 32 | 33 | #endif /* __TIMER_IRQ_H__ */ 34 | -------------------------------------------------------------------------------- /target/pulp/makefile.mk: -------------------------------------------------------------------------------- 1 | # Copyright 2020 ETH Zurich 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # SPDX-License-Identifier: Apache-2.0 16 | # Author: Robert Balas (balasr@iis.ee.ethz.ch) 17 | 18 | SRCS += $(dir)/crt0.S 19 | ifeq ($(CONFIG_FREERTOS_KERNEL),y) 20 | SRCS += $(dir)/system.c 21 | SRCS += $(dir)/vectors.S 22 | ifeq ($(CONFIG_CLUSTER),y) 23 | SRCS += $(dir)/cluster.S 24 | endif 25 | else 26 | SRCS += $(dir)/system_metal.c 27 | SRCS += $(dir)/vectors_metal.S 28 | endif 29 | 30 | CV_CPPFLAGS += -I$(FREERTOS_PROJ_ROOT)/$(dir)/include 31 | 32 | CV_LDFLAGS += -T$(FREERTOS_PROJ_ROOT)/$(dir)/link.ld 33 | -------------------------------------------------------------------------------- /support/gwrap.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # 3 | # Copyright (C) 2020 ETH Zurich 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | # SPDX-License-Identifier: Apache-2.0 18 | # Author: Robert Balas (balasr@iis.ee.ethz.ch) 19 | 20 | # Description: Instantiate gvsoc runner 21 | 22 | import sys 23 | import os 24 | sys.path.append(os.path.abspath('install/python')) 25 | sys.path.append(os.path.abspath('runner/python')) 26 | sys.path.append(os.path.abspath('pulp-configs/python')) 27 | sys.path.append(os.path.abspath('gvsoc/models')) 28 | import vp_runner 29 | 30 | from plp_runner import * 31 | 32 | runner = Runner() 33 | retval = runner.run() 34 | 35 | exit(retval) 36 | -------------------------------------------------------------------------------- /nortos/memscan/memscan.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 ETH Zurich 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * Author: Robert Balas (balasr@iis.ee.ethz.ch) 18 | */ 19 | 20 | /* 21 | * Description: Write to the whole l2 address space 22 | * (skipping the two private banks) 23 | */ 24 | 25 | #include 26 | #include 27 | #include "io.h" 28 | 29 | int main(int argc, char *argv[]) 30 | { 31 | uint32_t val = 0; 32 | printf("memscan start\n"); 33 | for (uint32_t addr = 0x1c010000; addr < 0x1c080000; addr += 4) { 34 | val += 1; 35 | writew(val, addr); 36 | } 37 | printf("memscan finished\n"); 38 | return EXIT_SUCCESS; 39 | } 40 | -------------------------------------------------------------------------------- /target/pulp/include/system.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 ETH Zurich 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * Author: Robert Balas (balasr@iis.ee.ethz.ch) 18 | */ 19 | 20 | /* Description: Platform system level functions */ 21 | 22 | #ifndef __SYSTEM_H__ 23 | #define __SYSTEM_H__ 24 | 25 | #include 26 | #include 27 | 28 | #include "FreeRTOSConfig.h" 29 | 30 | #define DEFAULT_SYSTEM_CLOCK 50000000u /* Default System clock value */ 31 | 32 | extern volatile uint32_t system_core_clock; 33 | 34 | void system_init(void); 35 | void system_core_clock_update(void); 36 | uint32_t system_core_clock_get(void); 37 | 38 | #endif /* __SYSTEM_H_ */ 39 | -------------------------------------------------------------------------------- /target/control-pulp/makefile.mk: -------------------------------------------------------------------------------- 1 | # Copyright 2020 ETH Zurich 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # SPDX-License-Identifier: Apache-2.0 16 | # Author: Robert Balas (balasr@iis.ee.ethz.ch) 17 | 18 | SRCS += $(dir)/crt0.S 19 | ifeq ($(CONFIG_FREERTOS_KERNEL),y) 20 | SRCS += $(dir)/system.c 21 | SRCS += $(dir)/vectors.S 22 | ifeq ($(CONFIG_CLUSTER),y) 23 | SRCS += $(dir)/cluster.S 24 | endif 25 | else 26 | SRCS += $(dir)/system_metal.c 27 | SRCS += $(dir)/vectors_metal.S 28 | endif 29 | 30 | CV_CPPFLAGS += -I$(FREERTOS_PROJ_ROOT)/$(dir)/include 31 | 32 | ifeq ($(CONFIG_DRIVER_INT),clic) 33 | CV_LDFLAGS += -T$(FREERTOS_PROJ_ROOT)/$(dir)/link_clic.ld 34 | else 35 | CV_LDFLAGS += -T$(FREERTOS_PROJ_ROOT)/$(dir)/link.ld 36 | endif 37 | -------------------------------------------------------------------------------- /target/core-v-mcu/include/system.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 ETH Zurich 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * Author: Robert Balas (balasr@iis.ee.ethz.ch) 18 | */ 19 | 20 | /* Description: Platform system level functions */ 21 | 22 | #ifndef __SYSTEM_H__ 23 | #define __SYSTEM_H__ 24 | 25 | #include 26 | #include 27 | 28 | #include "FreeRTOSConfig.h" 29 | 30 | #define DEFAULT_SYSTEM_CLOCK 50000000u /* Default System clock value */ 31 | 32 | extern volatile uint32_t system_core_clock; 33 | 34 | void system_init(void); 35 | void system_core_clock_update(void); 36 | uint32_t system_core_clock_get(void); 37 | 38 | #endif /* __SYSTEM_H_ */ 39 | -------------------------------------------------------------------------------- /target/pulpissimo/include/system.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 ETH Zurich 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * Author: Robert Balas (balasr@iis.ee.ethz.ch) 18 | */ 19 | 20 | /* Description: Platform system level functions */ 21 | 22 | #ifndef __SYSTEM_H__ 23 | #define __SYSTEM_H__ 24 | 25 | #include 26 | #include 27 | 28 | #include "FreeRTOSConfig.h" 29 | 30 | #define DEFAULT_SYSTEM_CLOCK 50000000u /* Default System clock value */ 31 | 32 | extern volatile uint32_t system_core_clock; 33 | 34 | void system_init(void); 35 | void system_core_clock_update(void); 36 | uint32_t system_core_clock_get(void); 37 | 38 | #endif /* __SYSTEM_H_ */ 39 | -------------------------------------------------------------------------------- /drivers/include/clkdiv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 ETH Zurich and University of Bologna 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | */ 18 | /* Driver to control the soc control clock divider used in some PULP based 19 | * chips/IPs. This driver is mutually exclusive with the fll driver 20 | */ 21 | /* Author: Robert Balas (balasr@iis.ee.ethz.ch) 22 | */ 23 | 24 | #ifndef __CLKDIV_H__ 25 | #define __CLKDIV_H__ 26 | /* soc clock division register offset */ 27 | #define CLKDIV_FC_OFFSET 0xf00 28 | /* cluster clock division register offset */ 29 | #define CLKDIV_CL_OFFSET 0xf08 30 | /* peripheral clock division register offset */ 31 | #define CLKDIV_PERIPH_OFFSET 0xf10 32 | 33 | #endif /* __CLKDIV_H__ */ 34 | -------------------------------------------------------------------------------- /drivers/include/pinmux.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 ETH Zurich and University of Bologna 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | */ 18 | 19 | /* Driver to control and configure pad mux */ 20 | 21 | /* Author: Robert Balas (balasr@iis.ee.ethz.ch) */ 22 | 23 | #include 24 | 25 | #include "apb_soc.h" 26 | #include "io.h" 27 | #include "pulp_mem_map.h" 28 | 29 | #define PINMUX_FUNC_A 0 30 | #define PINMUX_FUNC_B 1 31 | #define PINMUX_FUNC_C 2 32 | #define PINMUX_FUNC_D 3 33 | /* This doesn't exist on PULP */ 34 | #define PINMUX_FUNC_E 4 35 | #define PINMUX_FUNC_F 5 36 | #define PINMUX_FUNC_G 6 37 | #define PINMUX_FUNC_H 7 38 | 39 | int pinmux_pin_set(int pin, uint32_t func); 40 | 41 | int pinmux_pin_get(int pin, uint32_t *func); 42 | -------------------------------------------------------------------------------- /target/control-pulp/include/system.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 ETH Zurich 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * Author: Robert Balas (balasr@iis.ee.ethz.ch) 18 | */ 19 | 20 | /* Description: Platform system level functions */ 21 | 22 | #ifndef __SYSTEM_H__ 23 | #define __SYSTEM_H__ 24 | 25 | #include 26 | #include 27 | 28 | #include "properties.h" 29 | #include "FreeRTOSConfig.h" 30 | 31 | #ifndef DEFAULT_SYSTEM_CLOCK 32 | /* Default System clock value */ 33 | #define DEFAULT_SYSTEM_CLOCK ASIC_SYSTEM_CLOCK 34 | #endif 35 | 36 | extern volatile uint32_t system_core_clock; 37 | 38 | void system_init(void); 39 | void system_core_clock_update(void); 40 | uint32_t system_core_clock_get(void); 41 | 42 | #endif /* __SYSTEM_H_ */ 43 | -------------------------------------------------------------------------------- /nortos/setjmp/setjmptest.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 ETH Zurich 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * Author: Robert Balas (balasr@iis.ee.ethz.ch) 18 | */ 19 | 20 | /* Test if newlib's setjmp/longjmp works */ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | void eval(jmp_buf env, int prev_ret) 27 | { 28 | int ret = 0; 29 | if (prev_ret == 0) 30 | ret = prev_ret; 31 | else 32 | ret = prev_ret + 1; 33 | 34 | printf("long jump, got result %d\n", ret); 35 | longjmp(env, ret); 36 | } 37 | 38 | int main(int argc, char *argv[]) 39 | { 40 | jmp_buf env; 41 | int ret = setjmp(env); 42 | 43 | printf("ret addr is 0x%08x\n", ret); 44 | 45 | if (ret > 1) 46 | return EXIT_SUCCESS; 47 | 48 | eval(env, ret); 49 | 50 | return EXIT_FAILURE; 51 | } 52 | -------------------------------------------------------------------------------- /env/control-pulp.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Copyright 2021 ETH Zurich 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | # SPDX-License-Identifier: Apache-2.0 18 | # Author: Robert Balas (balasr@iis.ee.ethz.ch) 19 | 20 | # var that points to this project's root 21 | ROOT=$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")/.." && pwd) 22 | export FREERTOS_PROJ_ROOT="$ROOT" 23 | export FREERTOS_CONFIG_FAMILY="control-pulp" 24 | 25 | export CONFIG_TARGET="control-pulp" 26 | 27 | source "$ROOT/env/default-config.sh" 28 | 29 | export CONFIG_FREERTOS_CHIP_INCLUDE=ControlPULP_CV32E40P 30 | 31 | export CONFIG_PLUSARG_SIM=y 32 | 33 | export CONFIG_CLUSTER=y 34 | export CONFIG_DRIVER_FLL=n 35 | export CONFIG_DRIVER_CLKDIV=y 36 | export CONFIG_DRIVER_INT=clic 37 | 38 | # control-pulp has an I2C acknowledge register/interrupt feature 39 | export CONFIG_UDMA_I2C_ACK=y 40 | export CONFIG_UDMA_I2C_EOT=y 41 | -------------------------------------------------------------------------------- /template/hello_world/helloworld.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 ETH Zurich 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | * SOFTWARE. 21 | * 22 | * SPDX-License-Identifier: MIT 23 | * Author: Robert Balas (balasr@iis.ee.ethz.ch) 24 | */ 25 | 26 | #include 27 | #include 28 | 29 | int main(int argc, char *argv[]) 30 | { 31 | printf("hello world!\n"); 32 | return EXIT_SUCCESS; 33 | } 34 | -------------------------------------------------------------------------------- /drivers/include/fc_event.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 GreenWaves Technologies 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | */ 18 | 19 | #ifndef __FC_EVENT_H__ 20 | #define __FC_EVENT_H__ 21 | 22 | #include "events.h" 23 | #include "irq.h" 24 | 25 | #define NB_SOC_EVENTS (SOC_EU_NB_FC_EVENTS) 26 | 27 | typedef void (*pi_fc_event_handler_t)(void *arg); 28 | 29 | void pi_fc_event_handler_init(uint32_t fc_event_irq); 30 | 31 | /*! 32 | * @brief FC event handler. 33 | * 34 | * This function pops an event and executes the handler corresponding to the 35 | * event. 36 | */ 37 | void fc_soc_event_handler(void); 38 | 39 | void pi_fc_event_handler_set(uint32_t event_id, 40 | pi_fc_event_handler_t event_handler); 41 | 42 | void pi_fc_event_handler_clear(uint32_t event_id); 43 | 44 | void clear_fc_event_handler(uint32_t event_id); 45 | 46 | 47 | #endif /* __FC_EVENT_H__ */ 48 | -------------------------------------------------------------------------------- /support/egvsoc.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Copyright 2020 ETH Zurich 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | # SPDX-License-Identifier: Apache-2.0 18 | # Author: Robert Balas (balasr@iis.ee.ethz.ch) 19 | 20 | SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" 21 | 22 | SUPPORT_DIR="$SCRIPTPATH" 23 | export INSTALL_DIR="$SUPPORT_DIR/install" 24 | # export PULP_CURRENT_CONFIG="pulp@config_file=chips/pulp/pulp.json" 25 | # two paths because buggy lookup in gvsoc and related scripts 26 | export PULP_CONFIGS_PATH="$SUPPORT_DIR/pulp-configs/configs:$SUPPORT_DIR/pulp-configs" 27 | 28 | export PATH="$SUPPORT_DIR/install/bin:$PATH" 29 | export PYTHONPATH="$SUPPORT_DIR/install/python" 30 | # hack the ld path to make the the shared libraries find the shared libraries 31 | # they want to load 32 | export LD_LIBRARY_PATH="$SUPPORT_DIR/install/lib:$LD_LIBRARY_PATH" 33 | 34 | # need to cd otherwise gvsoc.json has a bad path 35 | cd "$SCRIPTPATH" && ./gwrap.py "$@" 36 | -------------------------------------------------------------------------------- /libc/makefile.mk: -------------------------------------------------------------------------------- 1 | # Copyright 2020 ETH Zurich 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # SPDX-License-Identifier: Apache-2.0 16 | # Author: Robert Balas (balasr@iis.ee.ethz.ch) 17 | 18 | SRCS += $(dir)/syscalls.c 19 | SRCS += $(dir)/pulp_malloc.c 20 | ifeq ($(CONFIG_CLUSTER),y) 21 | SRCS += $(dir)/malloc/cl_l1_malloc.c 22 | SRCS += $(dir)/malloc/malloc_internal.c 23 | CV_CPPFLAGS += -I"$(FREERTOS_PROJ_ROOT)/$(dir)/malloc/include" 24 | endif 25 | CV_CPPFLAGS += -DSTDIO_FAKE=2 26 | CV_CPPFLAGS += -DSTDIO_UART=1 27 | CV_CPPFLAGS += -DSTDIO_NULL=0 28 | ifeq ($(CONFIG_STDIO),fake) 29 | CV_CPPFLAGS += -DCONFIG_STDIO=2 30 | else ifeq ($(CONFIG_STDIO),uart) 31 | CV_CPPFLAGS += -DCONFIG_STDIO=1 32 | CV_CPPFLAGS += -DSTDIO_UART_DEVICE_ID=$(CONFIG_STDIO_UART_DEVICE_ID) 33 | CV_CPPFLAGS += -DSTDIO_UART_BAUDRATE=$(CONFIG_STDIO_UART_BAUDRATE) 34 | CV_CPPFLAGS += -DSTDIO_UART_BUFSIZE=$(CONFIG_STDIO_UART_BUFSIZE) 35 | else ifeq ($(CONFIG_STDIO),null) 36 | CV_CPPFLAGS += -DCONFIG_STDIO=0 37 | endif 38 | -------------------------------------------------------------------------------- /drivers/clkconst.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 ETH Zurich and University of Bologna 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * 18 | * PULP FPGA implementations sometimes have non-configurable, constant clocks 19 | * for soc/cluster/periphs. 20 | * 21 | * Author: Robert Balas (balasr@iis.ee.ethz.ch) 22 | */ 23 | 24 | #include 25 | 26 | #include "properties.h" 27 | #include "freq.h" 28 | 29 | uint32_t pi_freq_get(pi_freq_domain_e domain) 30 | { 31 | /* TODO: build time switch between asic and fpga build */ 32 | switch (domain) { 33 | case PI_FREQ_DOMAIN_FC: 34 | return FPGA_SYSTEM_CLOCK; 35 | case PI_FREQ_DOMAIN_CL: 36 | return FPGA_SYSTEM_CLOCK; 37 | case PI_FREQ_DOMAIN_PERIPH: 38 | return FPGA_PERIPH_CLOCK; 39 | } 40 | /* unreachable */ 41 | return 0; 42 | } 43 | 44 | int32_t pi_freq_set(pi_freq_domain_e domain, uint32_t freq) 45 | { 46 | /* not possible to configure clocks */ 47 | return 1; 48 | } 49 | -------------------------------------------------------------------------------- /demos/shared/include/flash.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.3.0 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef FLASH_LED_H 29 | #define FLASH_LED_H 30 | 31 | void vStartLEDFlashTasks( UBaseType_t uxPriority ); 32 | 33 | #endif 34 | 35 | -------------------------------------------------------------------------------- /nortos/.clang-format: -------------------------------------------------------------------------------- 1 | # Copyright 2020 ETH Zurich 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # SPDX-License-Identifier: Apache-2.0 16 | # Author: Robert Balas (balasr@iis.ee.ethz.ch) 17 | 18 | --- 19 | BasedOnStyle: LLVM 20 | Language: Cpp 21 | UseTab: Always 22 | BreakBeforeBraces: Linux 23 | AllowShortIfStatementsOnASingleLine: false 24 | IndentCaseLabels: false 25 | SortIncludes: false 26 | ContinuationIndentWidth: 8 27 | ColumnLimit: 80 28 | AlwaysBreakBeforeMultilineStrings: true 29 | AllowShortLoopsOnASingleLine: false 30 | AllowShortFunctionsOnASingleLine: false 31 | AlignEscapedNewlinesLeft: false 32 | AlignTrailingComments: true 33 | AllowAllParametersOfDeclarationOnNextLine: false 34 | AlignAfterOpenBracket: true 35 | SpaceAfterCStyleCast: false 36 | MaxEmptyLinesToKeep: 2 37 | BreakBeforeBinaryOperators: NonAssignment 38 | BreakStringLiterals: false 39 | IndentWidth: 8 40 | BreakBeforeBinaryOperators: None 41 | AlignConsecutiveAssignments: false 42 | AlignConsecutiveDeclarations: false 43 | AlignConsecutiveMacros: true 44 | -------------------------------------------------------------------------------- /tests/.clang-format: -------------------------------------------------------------------------------- 1 | # Copyright 2020 ETH Zurich 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # SPDX-License-Identifier: Apache-2.0 16 | # Author: Robert Balas (balasr@iis.ee.ethz.ch) 17 | 18 | --- 19 | BasedOnStyle: LLVM 20 | Language: Cpp 21 | UseTab: Always 22 | BreakBeforeBraces: Linux 23 | AllowShortIfStatementsOnASingleLine: false 24 | IndentCaseLabels: false 25 | SortIncludes: false 26 | ContinuationIndentWidth: 8 27 | ColumnLimit: 80 28 | AlwaysBreakBeforeMultilineStrings: true 29 | AllowShortLoopsOnASingleLine: false 30 | AllowShortFunctionsOnASingleLine: false 31 | AlignEscapedNewlinesLeft: false 32 | AlignTrailingComments: true 33 | AllowAllParametersOfDeclarationOnNextLine: false 34 | AlignAfterOpenBracket: true 35 | SpaceAfterCStyleCast: false 36 | MaxEmptyLinesToKeep: 2 37 | BreakBeforeBinaryOperators: NonAssignment 38 | BreakStringLiterals: false 39 | IndentWidth: 8 40 | BreakBeforeBinaryOperators: None 41 | AlignConsecutiveAssignments: false 42 | AlignConsecutiveDeclarations: false 43 | AlignConsecutiveMacros: true 44 | -------------------------------------------------------------------------------- /template/blinky/.clang-format: -------------------------------------------------------------------------------- 1 | # Copyright 2020 ETH Zurich 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # SPDX-License-Identifier: Apache-2.0 16 | # Author: Robert Balas (balasr@iis.ee.ethz.ch) 17 | 18 | --- 19 | BasedOnStyle: LLVM 20 | Language: Cpp 21 | UseTab: Always 22 | BreakBeforeBraces: Linux 23 | AllowShortIfStatementsOnASingleLine: false 24 | IndentCaseLabels: false 25 | SortIncludes: false 26 | ContinuationIndentWidth: 8 27 | ColumnLimit: 80 28 | AlwaysBreakBeforeMultilineStrings: true 29 | AllowShortLoopsOnASingleLine: false 30 | AllowShortFunctionsOnASingleLine: false 31 | AlignEscapedNewlinesLeft: false 32 | AlignTrailingComments: true 33 | AllowAllParametersOfDeclarationOnNextLine: false 34 | AlignAfterOpenBracket: true 35 | SpaceAfterCStyleCast: false 36 | MaxEmptyLinesToKeep: 2 37 | BreakBeforeBinaryOperators: NonAssignment 38 | BreakStringLiterals: false 39 | IndentWidth: 8 40 | BreakBeforeBinaryOperators: None 41 | AlignConsecutiveAssignments: false 42 | AlignConsecutiveDeclarations: false 43 | AlignConsecutiveMacros: true 44 | -------------------------------------------------------------------------------- /template/hello_world/.clang-format: -------------------------------------------------------------------------------- 1 | # Copyright 2020 ETH Zurich 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # SPDX-License-Identifier: Apache-2.0 16 | # Author: Robert Balas (balasr@iis.ee.ethz.ch) 17 | 18 | --- 19 | BasedOnStyle: LLVM 20 | Language: Cpp 21 | UseTab: Always 22 | BreakBeforeBraces: Linux 23 | AllowShortIfStatementsOnASingleLine: false 24 | IndentCaseLabels: false 25 | SortIncludes: false 26 | ContinuationIndentWidth: 8 27 | ColumnLimit: 80 28 | AlwaysBreakBeforeMultilineStrings: true 29 | AllowShortLoopsOnASingleLine: false 30 | AllowShortFunctionsOnASingleLine: false 31 | AlignEscapedNewlinesLeft: false 32 | AlignTrailingComments: true 33 | AllowAllParametersOfDeclarationOnNextLine: false 34 | AlignAfterOpenBracket: true 35 | SpaceAfterCStyleCast: false 36 | MaxEmptyLinesToKeep: 2 37 | BreakBeforeBinaryOperators: NonAssignment 38 | BreakStringLiterals: false 39 | IndentWidth: 8 40 | BreakBeforeBinaryOperators: None 41 | AlignConsecutiveAssignments: false 42 | AlignConsecutiveDeclarations: false 43 | AlignConsecutiveMacros: true 44 | -------------------------------------------------------------------------------- /drivers/soc_eu.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 ETH Zurich and University of Bologna 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* Driver to control and configure the PULP event unit */ 18 | /* Author: Robert Balas (balasr@iis.ee.ethz.ch) 19 | */ 20 | 21 | #include 22 | #include "pulp_mem_map.h" 23 | #include "io.h" 24 | #include "soc_eu_metal.h" 25 | 26 | void soc_eu_mask_set(uint32_t offset, uint32_t mask) 27 | { 28 | writew(mask, (uintptr_t)(PULP_SOC_EU_ADDR + offset)); 29 | } 30 | 31 | uint32_t soc_eu_mask_get(uint32_t offset) 32 | { 33 | return readw((uintptr_t)(PULP_SOC_EU_ADDR + offset)); 34 | } 35 | 36 | /* void soc_eu_irq_mask_set(uint32_t mask) */ 37 | /* { */ 38 | /* writew(mask, PULP_SOC_EU_ADDR + ) */ 39 | /* } */ 40 | 41 | /* uint32_t soc_eu_irq_mask_get() */ 42 | /* { */ 43 | /* } */ 44 | 45 | void soc_eu_event_init() 46 | { 47 | /* deactivate all soc events */ 48 | for (unsigned i = 0; i < SOC_NB_EVENT_REGS; i++) { 49 | soc_eu_mask_set(SOC_FC_FIRST_MASK + i * 4, 0xffffffff); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /drivers/include/udma_spim.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 GreenWaves Technologies 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | */ 18 | 19 | /** 20 | * Defines/types and small low level driver for udma spim main functionnalities 21 | */ 22 | 23 | #ifndef __UDMA_SPIM_H__ 24 | #define __UDMA_SPIM_H__ 25 | 26 | #include "target.h" 27 | #include "spi_periph.h" 28 | #include "udma_core.h" 29 | 30 | #define SPIM(id) ((spi_t *) UDMA_SPIM(id)) 31 | 32 | static inline void spim_enqueue_channel(spi_t *spim, uint32_t addr, 33 | uint32_t size, uint32_t config, udma_channel_e channel) 34 | { 35 | switch(channel) 36 | { 37 | case(RX_CHANNEL): 38 | udma_enqueue_channel(&(spim->rx), addr, size, config); 39 | break; 40 | case(TX_CHANNEL): 41 | udma_enqueue_channel(&(spim->tx), addr, size, config); 42 | break; 43 | case(COMMAND_CHANNEL): 44 | udma_enqueue_channel(&(spim->cmd), addr, size, config); 45 | break; 46 | default: 47 | break; 48 | } 49 | } 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /demos/shared/include/flop.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.3.0 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef FLOP_TASKS_H 29 | #define FLOP_TASKS_H 30 | 31 | void vStartMathTasks( UBaseType_t uxPriority ); 32 | BaseType_t xAreMathsTaskStillRunning( void ); 33 | 34 | #endif 35 | 36 | 37 | -------------------------------------------------------------------------------- /demos/shared/include/mevents.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.3.0 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef EVENTS_TEST_H 29 | #define EVENTS_TEST_H 30 | 31 | void vStartMultiEventTasks( void ); 32 | BaseType_t xAreMultiEventTasksStillRunning( void ); 33 | 34 | #endif 35 | 36 | 37 | -------------------------------------------------------------------------------- /drivers/include/device.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 GreenWaves Technologies 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __DEVICE_H__ 18 | #define __DEVICE_H__ 19 | 20 | #include "pmsis_types.h" 21 | 22 | /* Open a device using its name if available 23 | * if no name is passed, just allocate necessary memory 24 | */ 25 | struct pi_device *pi_open(const char *name); 26 | 27 | void pi_open_from_conf(struct pi_device *device, void *conf); 28 | 29 | int pmsis_close(struct pi_device *device); 30 | 31 | /* ioctl like mechanism */ 32 | uint32_t pmsis_ioctl(struct pi_device *device, uint32_t func_id, void *arg); 33 | 34 | /* Generic write and read functions: 35 | * write or read to devices (spi, i2s, (hyper)flash...) 36 | * might be null for devices which are not concerned 37 | */ 38 | uint32_t pmsis_write(struct pi_device *device, uintptr_t size, const void *addr, 39 | const void *buffer); 40 | 41 | uint32_t pmsis_read(struct pi_device *device, uintptr_t size, const void *addr, 42 | const void *buffer); 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /demos/shared/include/AbortDelay.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.3.0 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef ABORT_DELAY_H 29 | #define ABORT_DELAY_H 30 | 31 | void vCreateAbortDelayTasks( void ); 32 | BaseType_t xAreAbortDelayTestTasksStillRunning( void ); 33 | 34 | #endif 35 | 36 | 37 | -------------------------------------------------------------------------------- /demos/shared/include/BlockQ.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.3.0 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef BLOCK_Q_H 29 | #define BLOCK_Q_H 30 | 31 | void vStartBlockingQueueTasks( UBaseType_t uxPriority ); 32 | BaseType_t xAreBlockingQueuesStillRunning( void ); 33 | 34 | #endif 35 | 36 | 37 | -------------------------------------------------------------------------------- /demos/shared/include/PollQ.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.3.0 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef POLLED_Q_H 29 | #define POLLED_Q_H 30 | 31 | void vStartPolledQueueTasks( UBaseType_t uxPriority ); 32 | BaseType_t xArePollingQueuesStillRunning( void ); 33 | 34 | #endif 35 | 36 | 37 | -------------------------------------------------------------------------------- /demos/shared/include/blocktim.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.3.0 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef BLOCK_TIME_TEST_H 29 | #define BLOCK_TIME_TEST_H 30 | 31 | void vCreateBlockTimeTasks( void ); 32 | BaseType_t xAreBlockTimeTestTasksStillRunning( void ); 33 | 34 | #endif 35 | 36 | 37 | -------------------------------------------------------------------------------- /demos/shared/include/death.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.3.0 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef SUICIDE_TASK_H 29 | #define SUICIDE_TASK_H 30 | 31 | void vCreateSuicidalTasks( UBaseType_t uxPriority ); 32 | BaseType_t xIsCreateTaskStillRunning( void ); 33 | 34 | #endif 35 | 36 | 37 | -------------------------------------------------------------------------------- /demos/shared/include/semtest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.3.0 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef SEMAPHORE_TEST_H 29 | #define SEMAPHORE_TEST_H 30 | 31 | void vStartSemaphoreTasks( UBaseType_t uxPriority ); 32 | BaseType_t xAreSemaphoreTasksStillRunning( void ); 33 | 34 | #endif 35 | 36 | -------------------------------------------------------------------------------- /demos/shared/include/recmutex.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.3.0 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef RECURSIVE_MUTEX_TEST_H 29 | #define RECURSIVE_MUTEX_TEST_H 30 | 31 | void vStartRecursiveMutexTasks( void ); 32 | BaseType_t xAreRecursiveMutexTasksStillRunning( void ); 33 | 34 | #endif 35 | 36 | -------------------------------------------------------------------------------- /demos/shared/include/QPeek.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.3.0 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef Q_PEEK_TEST_H 29 | #define Q_PEEK_TEST_H 30 | 31 | void vStartQueuePeekTasks( void ); 32 | BaseType_t xAreQueuePeekTasksStillRunning( void ); 33 | 34 | #endif /* Q_PEEK_TEST_H */ 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /demos/shared/include/countsem.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.3.0 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef COUNT_SEMAPHORE_TEST_H 29 | #define COUNT_SEMAPHORE_TEST_H 30 | 31 | void vStartCountingSemaphoreTasks( void ); 32 | BaseType_t xAreCountingSemaphoreTasksStillRunning( void ); 33 | 34 | #endif 35 | 36 | -------------------------------------------------------------------------------- /demos/shared/include/integer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.3.0 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef INTEGER_TASKS_H 29 | #define INTEGER_TASKS_H 30 | 31 | void vStartIntegerMathTasks( UBaseType_t uxPriority ); 32 | BaseType_t xAreIntegerMathsTaskStillRunning( void ); 33 | 34 | #endif 35 | 36 | 37 | -------------------------------------------------------------------------------- /demos/shared/include/dynamic.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.3.0 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef DYNAMIC_MANIPULATION_H 29 | #define DYNAMIC_MANIPULATION_H 30 | 31 | void vStartDynamicPriorityTasks( void ); 32 | BaseType_t xAreDynamicPriorityTasksStillRunning( void ); 33 | 34 | #endif 35 | 36 | 37 | -------------------------------------------------------------------------------- /demos/shared/include/comtest2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.3.0 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef COMTEST_H 29 | #define COMTEST_H 30 | 31 | void vAltStartComTestTasks( UBaseType_t uxPriority, uint32_t ulBaudRate, UBaseType_t uxLED ); 32 | BaseType_t xAreComTestTasksStillRunning( void ); 33 | 34 | #endif 35 | 36 | -------------------------------------------------------------------------------- /drivers/device.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 GreenWaves Technologies 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | */ 18 | 19 | #include "device.h" 20 | 21 | static inline pi_device_e get_pi_device_type(void *conf); 22 | 23 | /* extract pi_device_type */ 24 | static inline pi_device_e get_pi_device_type(void *conf) 25 | { 26 | pi_device_e *device_ptr = (pi_device_e *)conf; 27 | return *device_ptr; 28 | } 29 | 30 | void pi_open_from_conf(struct pi_device *device, void *conf) 31 | { 32 | #if 0 33 | pi_device_e device_type = get_pi_device_type(conf); 34 | switch (device_type) { 35 | case PI_DEVICE_CLUSTER_TYPE: 36 | device->config = conf; 37 | pi_cluster_open(device); 38 | break; 39 | case PI_DEVICE_CPI_TYPE: 40 | case PI_DEVICE_HYPERBUS_TYPE: 41 | case PI_DEVICE_I2C_TYPE: 42 | case PI_DEVICE_SPI_TYPE: 43 | case PI_DEVICE_GPIO_TYPE: 44 | device->config = conf; 45 | break; 46 | default: 47 | device->config = conf; 48 | // TODO: add debug warning here 49 | break; 50 | } 51 | #else 52 | device->config = conf; 53 | #endif 54 | } 55 | -------------------------------------------------------------------------------- /demos/shared/include/print.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.3.0 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef PRINT_H 29 | #define PRINT_H 30 | 31 | void vPrintInitialise( void ); 32 | void vPrintDisplayMessage( const char * const * pcMessageToSend ); 33 | const char *pcPrintGetNextMessage( TickType_t xPrintRate ); 34 | 35 | #endif 36 | 37 | 38 | -------------------------------------------------------------------------------- /demos/shared/include/StaticAllocation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.3.0 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef STATIC_ALLOCATION_H 29 | #define STATIC_ALLOCATION_H 30 | 31 | void vStartStaticallyAllocatedTasks( void ); 32 | BaseType_t xAreStaticAllocationTasksStillRunning( void ); 33 | 34 | #endif /* STATIC_ALLOCATION_H */ 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /demos/shared/include/comtest_strings.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.3.0 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef COMTEST_STRINGS_H 29 | #define COMTEST_STRINGS_H 30 | 31 | void vStartComTestStringsTasks( UBaseType_t uxPriority, uint32_t ulBaudRate, UBaseType_t uxLED ); 32 | BaseType_t xAreComTestTasksStillRunning( void ); 33 | 34 | #endif 35 | 36 | -------------------------------------------------------------------------------- /demos/shared/include/TaskNotify.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.3.0 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef TASK_NOTIFY_H 29 | #define TASK_NOTIFY_H 30 | 31 | void vStartTaskNotifyTask( void ); 32 | BaseType_t xAreTaskNotificationTasksStillRunning( void ); 33 | void xNotifyTaskFromISR( void ); 34 | 35 | #endif /* TASK_NOTIFY_H */ 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /demos/shared/include/GenQTest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.3.0 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef GEN_Q_TEST_H 29 | #define GEN_Q_TEST_H 30 | 31 | void vStartGenericQueueTasks( UBaseType_t uxPriority ); 32 | BaseType_t xAreGenericQueueTasksStillRunning( void ); 33 | void vMutexISRInteractionTest( void ); 34 | 35 | #endif /* GEN_Q_TEST_H */ 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /demos/shared/include/QueueSet.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.3.0 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef QUEUE_WAIT_MULTIPLE_H 29 | #define QUEUE_WAIT_MULTIPLE_H 30 | 31 | void vStartQueueSetTasks( void ); 32 | BaseType_t xAreQueueSetTasksStillRunning( void ); 33 | void vQueueSetAccessQueueSetFromISR( void ); 34 | 35 | #endif /* QUEUE_WAIT_MULTIPLE_H */ 36 | 37 | 38 | -------------------------------------------------------------------------------- /demos/shared/include/MessageBufferDemo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.3.0 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef MESSAGE_BUFFER_TEST_H 29 | #define MESSAGE_BUFFER_TEST_H 30 | 31 | void vStartMessageBufferTasks( configSTACK_DEPTH_TYPE xStackSize ); 32 | BaseType_t xAreMessageBufferTasksStillRunning( void ); 33 | 34 | #endif /* MESSAGE_BUFFER_TEST_H */ 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /demos/shared/include/IntSemTest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.3.0 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef INT_SEM_TEST_H 29 | #define INT_SEM_TEST_H 30 | 31 | void vStartInterruptSemaphoreTasks( void ); 32 | BaseType_t xAreInterruptSemaphoreTasksStillRunning( void ); 33 | void vInterruptSemaphorePeriodicTest( void ); 34 | 35 | #endif /* INT_SEM_TEST_H */ 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /demos/shared/include/fileIO.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.3.0 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef FILE_IO_H 29 | #define FILE_IO_H 30 | 31 | void vDisplayMessage( const char * const pcMessageToPrint ); 32 | void vWriteMessageToDisk( const char * const pcMessage ); 33 | void vWriteBufferToDisk( const char * const pcBuffer, uint32_t ulBufferLength ); 34 | 35 | #endif 36 | 37 | -------------------------------------------------------------------------------- /demos/shared/include/QueueSetPolling.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.3.0 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef QUEUE_SET_POLLING_H 29 | #define QUEUE_SET_POLLING_H 30 | 31 | void vStartQueueSetPollingTask( void ); 32 | BaseType_t xAreQueueSetPollTasksStillRunning( void ); 33 | void vQueueSetPollingInterruptAccess( void ); 34 | 35 | #endif /* QUEUE_SET_POLLING_H */ 36 | 37 | 38 | -------------------------------------------------------------------------------- /demos/shared/include/TimerDemo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.3.0 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef TIMER_DEMO_H 29 | #define TIMER_DEMO_H 30 | 31 | void vStartTimerDemoTask( TickType_t xBaseFrequencyIn ); 32 | BaseType_t xAreTimerDemoTasksStillRunning( TickType_t xCycleFrequency ); 33 | void vTimerPeriodicISRTests( void ); 34 | 35 | #endif /* TIMER_DEMO_H */ 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /demos/shared/include/QueueOverwrite.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.3.0 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef QUEUE_OVERWRITE_H 29 | #define QUEUE_OVERWRITE_H 30 | 31 | void vStartQueueOverwriteTask( UBaseType_t uxPriority ); 32 | BaseType_t xIsQueueOverwriteTaskStillRunning( void ); 33 | void vQueueOverwritePeriodicISRDemo( void ); 34 | 35 | #endif /* QUEUE_OVERWRITE_H */ 36 | 37 | 38 | -------------------------------------------------------------------------------- /demos/shared/include/StreamBufferDemo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.3.0 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef STREAM_BUFFER_TEST_H 29 | #define STREAM_BUFFER_TEST_H 30 | 31 | void vStartStreamBufferTasks( void ); 32 | BaseType_t xAreStreamBufferTasksStillRunning( void ); 33 | void vPeriodicStreamBufferProcessing( void ); 34 | 35 | #endif /* STREAM_BUFFER_TEST_H */ 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /demos/shared/include/partest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.3.0 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef PARTEST_H 29 | #define PARTEST_H 30 | 31 | #define partstDEFAULT_PORT_ADDRESS ( ( uint16_t ) 0x378 ) 32 | 33 | void vParTestInitialise( void ); 34 | void vParTestSetLED( UBaseType_t uxLED, BaseType_t xValue ); 35 | void vParTestToggleLED( UBaseType_t uxLED ); 36 | 37 | #endif 38 | 39 | -------------------------------------------------------------------------------- /demos/shared/include/StreamBufferInterrupt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.3.0 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef STREAM_BUFFER_INTERRUPT_H 29 | #define STREAM_BUFFER_INTERRUPT_H 30 | 31 | void vStartStreamBufferInterruptDemo( void ); 32 | void vBasicStreamBufferSendFromISR( void ); 33 | BaseType_t xIsInterruptStreamBufferDemoStillRunning( void ); 34 | 35 | #endif /* STREAM_BUFFER_INTERRUPT_H */ 36 | -------------------------------------------------------------------------------- /target/arch/core_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Greenwaves Technologies 3 | * Copyright 2020 ETH Zurich 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | * SPDX-License-Identifier: Apache-2.0 18 | */ 19 | 20 | #ifndef __PMSIS_CORE_UTILS__ 21 | #define __PMSIS_CORE_UTILS__ 22 | 23 | #include "csr.h" 24 | 25 | /** FC_CLUSTER_ID Definitions */ 26 | #define FC_CLUSTER_ID 32 /**< FC CLuster ID */ 27 | 28 | /** 29 | \ingroup CMSIS_Core_IDFunctionInterface 30 | \defgroup CMSIS_Core_IDFunctions ID Functions 31 | \brief Functions that manage Cluster and Core ID. 32 | @{ 33 | */ 34 | 35 | static inline uint32_t __native_core_id() 36 | { 37 | /* encoding of mhartid: {21'b0, cluster_id_i[5:0], 1'b0, core_id_i[3:0]} 38 | */ 39 | uint32_t mhartid = csr_read(MHARTID_ADDR); 40 | return mhartid & 0x01f; 41 | } 42 | 43 | static inline uint32_t __native_cluster_id() 44 | { 45 | /* encoding of mhartid {21'b0, cluster_id_i[5:0], 1'b0, core_id_i[3:0]} 46 | */ 47 | uint32_t mhartid = csr_read(MHARTID_ADDR); 48 | return (mhartid >> 5) & 0x3f; 49 | } 50 | 51 | static inline uint32_t __native_is_fc() 52 | { 53 | return (__native_cluster_id() == FC_CLUSTER_ID); 54 | } 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /demos/shared/include/MessageBufferAMP.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.3.0 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef MESSAGE_BUFFER_AMP_H 29 | #define MESSAGE_BUFFER_AMP_H 30 | 31 | void vStartMessageBufferAMPTasks( configSTACK_DEPTH_TYPE xStackSize ); 32 | BaseType_t xAreMessageBufferAMPTasksStillRunning( void ); 33 | void vGenerateCoreBInterrupt( void * xUpdatedMessageBuffer ); 34 | 35 | #endif /* MESSAGE_BUFFER_AMP_H */ 36 | -------------------------------------------------------------------------------- /demos/shared/include/IntQueue.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.3.0 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef QUEUE_ACCESS_TEST 29 | #define QUEUE_ACCESS_TEST 30 | 31 | void vStartInterruptQueueTasks( void ); 32 | BaseType_t xAreIntQueueTasksStillRunning( void ); 33 | BaseType_t xFirstTimerHandler( void ); 34 | BaseType_t xSecondTimerHandler( void ); 35 | 36 | #endif /* QUEUE_ACCESS_TEST */ 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /drivers/include/freq.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 GreenWaves Technologies 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | */ 18 | /* Control frequency for soc/cluster/peripheral domains */ 19 | 20 | #ifndef __FREQ_H__ 21 | #define __FREQ_H__ 22 | 23 | #include 24 | 25 | typedef enum { 26 | PI_FREQ_DOMAIN_FC = 0, 27 | PI_FREQ_DOMAIN_CL = 1, 28 | PI_FREQ_DOMAIN_PERIPH = 2 29 | } pi_freq_domain_e; 30 | 31 | /** 32 | * \brief Get current frequency of a domain. 33 | * 34 | * Gets the current frequency of a specific frequency domain in Hz. 35 | * 36 | * \param domain The frequency domain. 37 | * \return The frequency in Hz. 38 | */ 39 | uint32_t pi_freq_get(pi_freq_domain_e domain); 40 | 41 | /** 42 | * \brief Set frequency of a domain. 43 | * 44 | * Set thefrequency of a specific frequency domain in Hz. 45 | * This can return an error if the frequency is invalid. 46 | * 47 | * \param domain The frequency domain. 48 | * \param freq The desired frequency in Hz. 49 | * \return 0 if successfull, -1 otherwise. 50 | */ 51 | int32_t pi_freq_set(pi_freq_domain_e domain, uint32_t freq); 52 | 53 | #endif /* __FREQ_H__ */ 54 | -------------------------------------------------------------------------------- /demos/shared/include/comtest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.3.0 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef COMTEST_H 29 | #define COMTEST_H 30 | 31 | void vAltStartComTestTasks( UBaseType_t uxPriority, uint32_t ulBaudRate, UBaseType_t uxLED ); 32 | void vStartComTestTasks( UBaseType_t uxPriority, eCOMPort ePort, eBaud eBaudRate ); 33 | BaseType_t xAreComTestTasksStillRunning( void ); 34 | void vComTestUnsuspendTask( void ); 35 | 36 | #endif 37 | 38 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Copyright 2021 ETH Zurich 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # SPDX-License-Identifier: Apache-2.0 16 | # Author: Robert Balas (balasr@iis.ee.ethz.ch) 17 | 18 | TESTS = tests/hello_world_pmsis tests/uart tests/queue tests/semaphore \ 19 | tests/streambufferisr tests/timer \ 20 | nortos/hello_world nortos/memscan nortos/setjmp 21 | # tests/spi \ # atm messed up due to DPI 22 | # tests/cluster/cluster_fork_gvsim # does not work with gvsoc 23 | TEST_LOGS = test.log 24 | 25 | CTAGS = ctags 26 | 27 | check: test 28 | 29 | ## Run tests. Use separate build trees. 30 | .PHONY: test 31 | test: 32 | @[ -e $(TEST_LOGS) ] && cp $(TEST_LOGS) old_$(TEST_LOGS); \ 33 | rm -f $(TEST_LOGS); \ 34 | err=0; \ 35 | for test in $(TESTS); do \ 36 | printf "%-50s" "Running '$$test' ... "; \ 37 | source env/pulp.sh; \ 38 | mkdir -p $$test/build; \ 39 | pushd . > /dev/null; cd $$test/build; \ 40 | make -f ../Makefile all run-gvsoc >> $(TEST_LOGS); \ 41 | if [ $$? -eq 0 ]; then \ 42 | printf "PASS\n"; \ 43 | else \ 44 | err=$$?; \ 45 | fi; \ 46 | popd > /dev/null; \ 47 | done; \ 48 | exit $$err; 49 | 50 | .PHONY: TAGS 51 | TAGS: 52 | $(CTAGS) -R -e --exclude=support/* --exclude=template/* --exclude=*sim/* . 53 | -------------------------------------------------------------------------------- /demos/shared/include/crhook.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.3.0 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef CRHOOK_H 29 | #define CRHOOK_H 30 | 31 | /* 32 | * Create the co-routines used to communicate wit the tick hook. 33 | */ 34 | void vStartHookCoRoutines( void ); 35 | 36 | /* 37 | * Return pdPASS or pdFAIL depending on whether an error has been detected 38 | * or not. 39 | */ 40 | BaseType_t xAreHookCoRoutinesStillRunning( void ); 41 | 42 | #endif 43 | 44 | -------------------------------------------------------------------------------- /.clang-format: -------------------------------------------------------------------------------- 1 | # Copyright 2020 ETH Zurich 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # SPDX-License-Identifier: Apache-2.0 16 | # Author: Robert Balas (balasr@iis.ee.ethz.ch) 17 | 18 | --- 19 | BasedOnStyle: LLVM 20 | Language: Cpp 21 | UseTab: Always 22 | BreakBeforeBraces: Linux 23 | AllowShortIfStatementsOnASingleLine: false 24 | IndentCaseLabels: false 25 | SortIncludes: false 26 | ContinuationIndentWidth: 8 27 | ColumnLimit: 100 28 | AlwaysBreakBeforeMultilineStrings: true 29 | AllowShortLoopsOnASingleLine: false 30 | AllowShortFunctionsOnASingleLine: false 31 | AlignEscapedNewlinesLeft: false 32 | AlignTrailingComments: true 33 | AllowAllParametersOfDeclarationOnNextLine: false 34 | AlignAfterOpenBracket: true 35 | SpaceAfterCStyleCast: false 36 | MaxEmptyLinesToKeep: 2 37 | BreakBeforeBinaryOperators: NonAssignment 38 | BreakStringLiterals: false 39 | IndentWidth: 8 40 | BreakBeforeBinaryOperators: None 41 | AlignConsecutiveAssignments: false 42 | AlignConsecutiveDeclarations: false 43 | AlignConsecutiveMacros: true 44 | 45 | #PenaltyBreakAssignment: 10 46 | PenaltyBreakBeforeFirstCallParameter: 30 47 | PenaltyBreakComment: 10 48 | PenaltyBreakFirstLessLess: 0 49 | PenaltyBreakString: 10 50 | PenaltyExcessCharacter: 100 51 | PenaltyReturnTypeOnItsOwnLine: 60 52 | -------------------------------------------------------------------------------- /scripts/pulpstim: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright 2020 ETH Zurich 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | # SPDX-License-Identifier: Apache-2.0 18 | # Author: Robert Balas (balasr@iis.ee.ethz.ch) 19 | 20 | # pulpstim 21 | import argparse 22 | import os 23 | import sys 24 | from stim_utils import stim 25 | 26 | parser = argparse.ArgumentParser(prog='pulpstim', 27 | description="""Generate stimuli files from ELF 28 | files for the JTAG TAP in PULPissimo""") 29 | 30 | parser.version = '0.1' 31 | parser.add_argument('Path', metavar='path', 32 | type=str, help='the path to elf file') 33 | parser.add_argument('-o', '--output', metavar='output', 34 | type=str, help='the output file name') 35 | parser.add_argument('--verbose', action='store_true', 36 | help='enable verbose output') 37 | 38 | args = parser.parse_args() 39 | elf_file = args.Path 40 | 41 | if not os.path.isfile(elf_file): 42 | print('The specified path does not exist') 43 | sys.exit(1) 44 | 45 | stimuli_generator = stim(args.verbose) 46 | stimuli_generator.add_binary(elf_file) 47 | stimuli_generator.gen_stim_slm_64(args.output if args.output else 'stim.txt') 48 | -------------------------------------------------------------------------------- /drivers/pinmux.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 ETH Zurich and University of Bologna 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * Author: Robert Balas (balasr@iis.ee.ethz.ch) 18 | */ 19 | 20 | /* Driver to control and configure pad mux */ 21 | 22 | #include 23 | #include 24 | 25 | #include "io.h" 26 | #include "pulp_mem_map.h" 27 | #include "apb_soc.h" 28 | #include "pinmux.h" 29 | 30 | /* TODO: we only support pin 0-31 */ 31 | 32 | int pinmux_pin_set(int pin, uint32_t func) 33 | { 34 | assert(0 <= pin && pin < 32); 35 | 36 | uintptr_t padfun_reg = 37 | ((pin & 0xf) >> 4) * 4 + 38 | (PULP_APB_SOC_CTRL_ADDR + APB_SOC_PADFUN0_OFFSET); 39 | uint32_t padfun_shift = (pin & 0x7) << 1; /* 16 pads a 2 bits per reg */ 40 | writew((func & 0x3) << padfun_shift, padfun_reg); 41 | 42 | return 0; 43 | } 44 | 45 | int pinmux_pin_get(int pin, uint32_t *func) 46 | { 47 | assert(0 <= pin && pin < 32); 48 | 49 | uintptr_t padfun_reg = 50 | ((pin & 0xf) >> 4) * 4 + 51 | (PULP_APB_SOC_CTRL_ADDR + APB_SOC_PADFUN0_OFFSET); 52 | uint32_t padfun_shift = (pin & 0x7) << 1; /* 16 pads a 2 bits per reg */ 53 | uint32_t padfunval = readw(padfun_reg); 54 | *func = (padfunval >> padfun_shift) & 0x3; 55 | return 0; 56 | } 57 | -------------------------------------------------------------------------------- /demos/shared/include/EventGroupsDemo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.3.0 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | 29 | 30 | /* 31 | * This file contains fairly comprehensive checks on the behaviour of event 32 | * groups. It is not intended to be a user friendly demonstration of the event 33 | * groups API. 34 | */ 35 | 36 | #ifndef EVENT_GROUPS_DEMO_H 37 | #define EVENT_GROUPS_DEMO_H 38 | 39 | void vStartEventGroupTasks( void ); 40 | BaseType_t xAreEventGroupTasksStillRunning( void ); 41 | void vPeriodicEventGroupsProcessing( void ); 42 | 43 | #endif /* EVENT_GROUPS_DEMO_H */ 44 | 45 | -------------------------------------------------------------------------------- /drivers/include/udma_core.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 GreenWaves Technologies 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | */ 18 | 19 | #ifndef __UDMA_CORE_H__ 20 | #define __UDMA_CORE_H__ 21 | 22 | /** 23 | * Small low level driver for udma core main functionnalities 24 | */ 25 | 26 | #include "target.h" 27 | #include "udma.h" 28 | #include "udma_ctrl.h" 29 | 30 | #define UDMA_MAX_SIZE_LOG2 (17) 31 | #define UDMA_MAX_SIZE (1 << UDMA_MAX_SIZE_LOG2) 32 | 33 | 34 | static inline void udma_init_device(uint32_t device_id) 35 | { 36 | /* disable clock gating for device with device_id */ 37 | udma_ctrl_cg_disable(device_id); 38 | } 39 | 40 | /* 41 | * Common uDMA channel enqueue 42 | */ 43 | static inline void udma_enqueue_channel(udma_channel_t *chan, uint32_t addr, 44 | uint32_t size, uint32_t config) 45 | { 46 | hal_write32(&chan->saddr, addr); 47 | hal_write32(&chan->size, size); 48 | hal_write32(&chan->cfg, config); 49 | } 50 | 51 | static inline void udma_channel_clear(udma_channel_t *chan) 52 | { 53 | /* TODO: adjust macro */ 54 | hal_write32(&(chan->cfg), REG_SET(UDMA_CORE_RX_CFG_CLR, 1)); 55 | } 56 | 57 | static inline void udma_deinit_device(uint32_t device_id) 58 | { 59 | /* enable clock gating for device with device_id */ 60 | udma_ctrl_cg_enable(device_id); 61 | } 62 | 63 | #endif /* __UDMA_CORE_H__ */ 64 | -------------------------------------------------------------------------------- /drivers/include/pi_errno.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 GreenWaves Technologies 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * Created by Mathieu Barbe . 19 | * on 12/21/2019. 20 | */ 21 | 22 | #ifndef API_ERRNO_H 23 | #define API_ERRNO_H 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | typedef enum { 30 | PI_OK = 0x00, /*!< indicating success (no error) */ 31 | PI_FAIL = 0x01, /*!< Generic code indicating failure */ 32 | 33 | PI_ERR_INVALID_ARG = 0x02, /*!< Invalid argument */ 34 | PI_ERR_INVALID_STATE = 0x03, /*!< Invalid state */ 35 | PI_ERR_INVALID_SIZE = 0x04, /*!< Invalid size */ 36 | PI_ERR_NOT_FOUND = 0x05, /*!< Requested resource not found */ 37 | PI_ERR_NOT_SUPPORTED = 0x06, /*!< Operation or feature not supported */ 38 | PI_ERR_TIMEOUT = 0x07, /*!< Operation timed out */ 39 | PI_ERR_INVALID_CRC = 0x08, /*!< CRC or checksum was invalid */ 40 | PI_ERR_INVALID_VERSION = 0x09, /*!< Version was invalid */ 41 | PI_ERR_INVALID_APP = 0x0A, /*!< App binary is not compliant with GAP. */ 42 | PI_ERR_INVALID_MAGIC_CODE = 0x0B, /*!< Magic code does not match. */ 43 | 44 | PI_ERR_I2C_NACK = 0x100, /*! I2C request ended with a NACK */ 45 | 46 | PI_ERR_NO_MEM = 0x200, /*!< Generic out of memory */ 47 | PI_ERR_L2_NO_MEM = 0x201, /*!< L2 out of memory */ 48 | } pi_err_t; 49 | 50 | #ifdef __cplusplus 51 | } 52 | #endif 53 | #endif //API_ERRNO_H 54 | -------------------------------------------------------------------------------- /demos/shared/include/flash_timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.3.0 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef FLASH_TIMER_H 29 | #define FLASH_TIMER_H 30 | 31 | /* 32 | * Creates the LED flashing timers. xNumberOfLEDs specifies how many timers to 33 | * create, with each timer toggling a different LED. The first LED to be 34 | * toggled is LED 0, with subsequent LEDs following on in numerical order. Each 35 | * timer uses the exact same callback function, with the timer ID being used 36 | * within the callback function to determine which timer has actually expired 37 | * (and therefore which LED to toggle). 38 | */ 39 | void vStartLEDFlashTimers( UBaseType_t uxNumberOfLEDs ); 40 | 41 | #endif /* FLASH_TIMER_H */ 42 | -------------------------------------------------------------------------------- /demos/shared/include/crflash.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.3.0 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef CRFLASH_LED_H 29 | #define CRFLASH_LED_H 30 | 31 | /* 32 | * Create the co-routines used to flash the LED's at different rates. 33 | * 34 | * @param uxPriority The number of 'fixed delay' co-routines to create. This 35 | * also effects the number of LED's that will be utilised. For example, 36 | * passing in 3 will cause LED's 0 to 2 to be utilised. 37 | */ 38 | void vStartFlashCoRoutines( UBaseType_t uxPriority ); 39 | 40 | /* 41 | * Return pdPASS or pdFAIL depending on whether an error has been detected 42 | * or not. 43 | */ 44 | BaseType_t xAreFlashCoRoutinesStillRunning( void ); 45 | 46 | #endif 47 | 48 | -------------------------------------------------------------------------------- /drivers/makefile.mk: -------------------------------------------------------------------------------- 1 | # Copyright 2020 ETH Zurich 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # SPDX-License-Identifier: Apache-2.0 16 | # Author: Robert Balas (balasr@iis.ee.ethz.ch) 17 | 18 | SRCS += $(dir)/uart.c 19 | SRCS += $(dir)/spi.c 20 | SRCS += $(dir)/i2c.c 21 | ifeq ($(CONFIG_UDMA_I2C_ACK),y) 22 | CV_CPPFLAGS += -DCONFIG_UDMA_I2C_ACK 23 | endif 24 | ifeq ($(CONFIG_UDMA_I2C_EOT),y) 25 | CV_CPPFLAGS += -DCONFIG_UDMA_I2C_EOT 26 | endif 27 | ifeq ($(CONFIG_DRIVER_FLL),y) 28 | SRCS += $(dir)/fll.c 29 | else ifeq ($(CONFIG_DRIVER_CLKDIV),y) 30 | SRCS += $(dir)/clkdiv.c 31 | else ifeq ($(CONFIG_DRIVER_CLKCONST),y) 32 | SRCS += $(dir)/clkconst.c 33 | else 34 | $(error no driver for clock configuration enabled.) 35 | endif 36 | ifeq ($(CONFIG_CLUSTER),y) 37 | SRCS += $(dir)/cluster/cl_to_fc_delegate.c 38 | SRCS += $(dir)/cluster/fc_to_cl_delegate.c 39 | endif 40 | 41 | SRCS += $(dir)/timer_irq.c 42 | ifeq ($(CONFIG_DRIVER_INT),pclint) 43 | SRCS += $(dir)/pclint.c 44 | else ifeq ($(CONFIG_DRIVER_INT),clic) 45 | SRCS += $(dir)/clic.c 46 | CV_CPPFLAGS += -DCONFIG_CLIC 47 | else 48 | $(error no driver for interrupt controller enabled. Set CONFIG_DRIVER_INT) 49 | endif 50 | 51 | SRCS += $(dir)/soc_eu.c 52 | SRCS += $(dir)/gpio.c 53 | SRCS += $(dir)/pinmux.c 54 | SRCS += $(dir)/fc_event.c 55 | 56 | SRCS += $(dir)/pmsis_task.c 57 | SRCS += $(dir)/device.c 58 | 59 | CV_CPPFLAGS += -I"$(FREERTOS_PROJ_ROOT)/$(dir)/include" 60 | ifeq ($(CONFIG_CLUSTER),y) 61 | CV_CPPFLAGS += -I"$(FREERTOS_PROJ_ROOT)/$(dir)/include/cluster" 62 | CV_CPPFLAGS += -DCONFIG_CLUSTER 63 | endif 64 | -------------------------------------------------------------------------------- /nortos/memscan/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright 2020 ETH Zurich 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # SPDX-License-Identifier: Apache-2.0 16 | # Author: Robert Balas (balasr@iis.ee.ethz.ch) 17 | 18 | # Description: Makefile to build the blinky and other demo applications. Note 19 | # that it supports the usual GNU Make implicit variables e.g. CC, CFLAGS, 20 | # CPPFLAGS etc. Consult the GNU Make manual for move information about these. 21 | 22 | # Notes: 23 | # Useful targets 24 | # make all Compile and link 25 | # make run Simulate SoC 26 | # make backup Record your simulation run 27 | # make analyze Run analysis scripts on the simulation result 28 | 29 | # Important Variables 30 | # PROG Needs to be set to your executables name 31 | # USER_SRCS Add your source files here (use +=) 32 | # CPPFLAGS Add your include search paths and macro definitions (use +=) 33 | 34 | # For compile options check the README.md 35 | 36 | # indicate this repository's root folder 37 | PROJ_ROOT = $(shell git rev-parse --show-toplevel) 38 | 39 | # withouth kernel 40 | CONFIG_FREERTOS_KERNEL=n 41 | 42 | # good defaults for many environment variables 43 | include $(PROJ_ROOT)/default_flags.mk 44 | 45 | # rtos and pulp sources 46 | include $(PROJ_ROOT)/default_srcs.mk 47 | 48 | # application name 49 | PROG = memscan 50 | 51 | # application/user specific code 52 | USER_SRCS = memscan.c 53 | 54 | # system_metal_conf.h 55 | CPPFLAGS += $(addprefix -I$(USER_DIR)/, ".") 56 | 57 | CPPFLAGS += -DportasmHANDLE_INTERRUPT=undefined_handler 58 | 59 | # compile, simulation and analysis targets 60 | include $(PROJ_ROOT)/default_targets.mk 61 | -------------------------------------------------------------------------------- /nortos/setjmp/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright 2020 ETH Zurich 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # SPDX-License-Identifier: Apache-2.0 16 | # Author: Robert Balas (balasr@iis.ee.ethz.ch) 17 | 18 | # Description: Makefile to build the blinky and other demo applications. Note 19 | # that it supports the usual GNU Make implicit variables e.g. CC, CFLAGS, 20 | # CPPFLAGS etc. Consult the GNU Make manual for move information about these. 21 | 22 | # Notes: 23 | # Useful targets 24 | # make all Compile and link 25 | # make run Simulate SoC 26 | # make backup Record your simulation run 27 | # make analyze Run analysis scripts on the simulation result 28 | 29 | # Important Variables 30 | # PROG Needs to be set to your executables name 31 | # USER_SRCS Add your source files here (use +=) 32 | # CPPFLAGS Add your include search paths and macro definitions (use +=) 33 | 34 | # For compile options check the README.md 35 | 36 | # indicate this repository's root folder 37 | PROJ_ROOT = $(shell git rev-parse --show-toplevel) 38 | 39 | # withouth kernel 40 | CONFIG_FREERTOS_KERNEL=n 41 | 42 | # good defaults for many environment variables 43 | include $(PROJ_ROOT)/default_flags.mk 44 | 45 | # rtos and pulp sources 46 | include $(PROJ_ROOT)/default_srcs.mk 47 | 48 | # application name 49 | PROG = setjmptest 50 | 51 | # application/user specific code 52 | USER_SRCS = setjmptest.c 53 | 54 | # system_metal_conf.h 55 | CPPFLAGS += $(addprefix -I$(USER_DIR)/, ".") 56 | 57 | CPPFLAGS += -DportasmHANDLE_INTERRUPT=undefined_handler 58 | 59 | # compile, simulation and analysis targets 60 | include $(PROJ_ROOT)/default_targets.mk 61 | -------------------------------------------------------------------------------- /nortos/hello_world/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright 2020 ETH Zurich 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # SPDX-License-Identifier: Apache-2.0 16 | # Author: Robert Balas (balasr@iis.ee.ethz.ch) 17 | 18 | # Description: Makefile to build the blinky and other demo applications. Note 19 | # that it supports the usual GNU Make implicit variables e.g. CC, CFLAGS, 20 | # CPPFLAGS etc. Consult the GNU Make manual for move information about these. 21 | 22 | # Notes: 23 | # Useful targets 24 | # make all Compile and link 25 | # make run Simulate SoC 26 | # make backup Record your simulation run 27 | # make analyze Run analysis scripts on the simulation result 28 | 29 | # Important Variables 30 | # PROG Needs to be set to your executables name 31 | # USER_SRCS Add your source files here (use +=) 32 | # CPPFLAGS Add your include search paths and macro definitions (use +=) 33 | 34 | # For compile options check the README.md 35 | 36 | # indicate this repository's root folder 37 | PROJ_ROOT = $(shell git rev-parse --show-toplevel) 38 | 39 | # withouth kernel 40 | CONFIG_FREERTOS_KERNEL=n 41 | 42 | # good defaults for many environment variables 43 | include $(PROJ_ROOT)/default_flags.mk 44 | 45 | # rtos and pulp sources 46 | include $(PROJ_ROOT)/default_srcs.mk 47 | 48 | # application name 49 | PROG = helloworld 50 | 51 | # application/user specific code 52 | USER_SRCS = helloworld.c 53 | 54 | # system_metal_conf.h 55 | CPPFLAGS += $(addprefix -I$(USER_DIR)/, ".") 56 | 57 | CPPFLAGS += -DportasmHANDLE_INTERRUPT=undefined_handler -D__PULP__ 58 | 59 | # compile, simulation and analysis targets 60 | include $(PROJ_ROOT)/default_targets.mk 61 | -------------------------------------------------------------------------------- /drivers/include/debug.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 GreenWaves Technologies 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | */ 18 | 19 | #ifndef __DEBUG_H__ 20 | #define __DEBUG_H__ 21 | 22 | /* Define those flags in Makefile or command line to enable traces/logs. */ 23 | 24 | #if defined(TRACE_CPI) 25 | #define CPI_TRACE(...) PI_LOG_DBG(__func__, __VA_ARGS__) 26 | #define CPI_TRACE_ERR(...) PI_LOG_ERR(__func__, __VA_ARGS__) 27 | #else 28 | #define CPI_TRACE(...) ((void)0) 29 | #define CPI_TRACE_ERR(...) ((void)0) 30 | #endif /* TRACE_CPI */ 31 | 32 | #if defined(TRACE_I2S) 33 | #define I2S_TRACE(...) PI_LOG_DBG(__func__, __VA_ARGS__) 34 | #define I2S_TRACE_ERR(...) PI_LOG_ERR(__func__, __VA_ARGS__) 35 | #else 36 | #define I2S_TRACE(...) ((void)0) 37 | #define I2S_TRACE_ERR(...) ((void)0) 38 | #endif /* TRACE_I2S */ 39 | 40 | #if defined(TRACE_UART) 41 | #define UART_TRACE(...) PI_LOG_DBG(__func__, __VA_ARGS__) 42 | #define UART_TRACE_ERR(...) PI_LOG_ERR(__func__, __VA_ARGS__) 43 | #else 44 | #define UART_TRACE(...) ((void)0) 45 | #define UART_TRACE_ERR(...) ((void)0) 46 | #endif /* TRACE_UART */ 47 | 48 | #if defined(TRACE_I2C) 49 | #define I2C_TRACE(...) PI_LOG_DBG(__func__, __VA_ARGS__) 50 | #define I2C_TRACE_ERR(...) PI_LOG_ERR(__func__, __VA_ARGS__) 51 | #else 52 | #define I2C_TRACE(...) ((void) 0) 53 | #define I2C_TRACE_ERR(...) ((void) 0) 54 | #endif /* TRACE_I2C */ 55 | 56 | /* Debug helper. */ 57 | #if defined (DEBUG_TASKS) 58 | #define DEBUG_PRINTF printf 59 | #else 60 | #define DEBUG_PRINTF(...) ((void)0) 61 | #endif /* DEBUG */ 62 | 63 | 64 | #endif /* __DEBUG_H__ */ 65 | -------------------------------------------------------------------------------- /drivers/include/implementation_specific_defines.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 GreenWaves Technologies 3 | * Copyright 2020 ETH Zurich 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | * SPDX-License-Identifier: Apache-2.0 18 | */ 19 | 20 | #ifndef __IMPLEMENTATION_SPECIFIC_DEFINES_H__ 21 | #define __IMPLEMENTATION_SPECIFIC_DEFINES_H__ 22 | 23 | #include 24 | #include "stdlib.h" 25 | #include "string.h" 26 | 27 | /* #if defined(__GAP8__) */ 28 | /* #include "system_gap8.h" */ 29 | /* #elif defined(__GAP9__) */ 30 | /* #include "system_gap9.h" */ 31 | /* #elif defined(__PULP__) */ 32 | /* #include "system_pulp_ri5cy.h" */ 33 | /* #else */ 34 | /* #error "Target specific macro is not set. Recommended to use __PULP__." */ 35 | /* #endif */ 36 | 37 | #define __INC_TO_STRING(x) #x 38 | 39 | #define PMSIS_TASK_EVENT_KERNEL_PRIORITY 2 40 | #define DEFAULT_MALLOC_INC __INC_TO_STRING(pmsis/rtos/malloc/l2_malloc.h) 41 | 42 | // default malloc for driver structs etc (might not be compatible with udma!) 43 | /* TODO: rereoute to newlib malloc (?)*/ 44 | #define pi_default_malloc(x) malloc(x) 45 | #define pi_default_free(x,y) free(x) 46 | #define pi_data_malloc(x) malloc(x) 47 | #define pi_data_free(x,y) free(x) 48 | /* TODO: hack */ 49 | #define pmsis_l2_malloc pi_l2_malloc 50 | #define pmsis_l2_malloc_align pi_l2_malloc_align 51 | #define pmsis_l2_malloc_free pi_l2_free 52 | #define pmsis_l2_malloc_init pi_l2_malloc_init 53 | #define pmsis_l2_malloc_dump pi_l2_malloc_dump 54 | 55 | #ifndef PI_TASK_IMPLEM 56 | #define PI_TASK_IMPLEM \ 57 | uint8_t destroy; 58 | #endif 59 | #define CLUSTER_TASK_IMPLEM \ 60 | uint32_t cluster_team_mask; 61 | #endif /* __IMPLEMENTATION_SPECIFIC_DEFINES_H__ */ 62 | -------------------------------------------------------------------------------- /target/control-pulp/system_metal.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 ETH Zurich 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * Author: Robert Balas (balasr@iis.ee.ethz.ch) 18 | */ 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #include "system_metal_conf.h" 25 | 26 | #include "fll.h" 27 | #include "irq.h" 28 | #include "soc_eu.h" 29 | 30 | #ifndef DISABLE_WDOG 31 | #define DISABLE_WDOG 1 32 | #endif 33 | 34 | /* test some assumptions we make about compiler settings */ 35 | static_assert(sizeof(uintptr_t) == 4, 36 | "uintptr_t is not 4 bytes. Make sure you are using -mabi=ilp32*"); 37 | 38 | /* Allocate heap to special section. Note that we have no references in the 39 | * whole program to this variable (since its just here to allocate space in the 40 | * section for our heap), so when using LTO it will be removed. We force it to 41 | * stay with the "used" attribute 42 | */ 43 | __attribute__((section(".heap"), used)) uint8_t ucHeap[configTOTAL_HEAP_SIZE]; 44 | 45 | uint32_t volatile system_core_clock = DEFAULT_SYSTEM_CLOCK; 46 | 47 | /** 48 | * Board init code. Always call this before anything else. 49 | */ 50 | void system_init(void) 51 | { 52 | /* make sure irq (itc) is a good state */ 53 | pulp_irq_init(); 54 | 55 | /* mtvec is set in crt0.S */ 56 | 57 | /* deactivate all soc events as they are enabled by default */ 58 | soc_eu_event_init(); 59 | 60 | /* TODO: enable uart */ 61 | /* TODO: I$ enable*/ 62 | /* enable core level interrupt (mie) */ 63 | irq_clint_global_enable(); 64 | } 65 | 66 | // 67 | void system_core_clock_update() 68 | { 69 | system_core_clock = pi_fll_get_frequency(FLL_SOC, 0); 70 | } 71 | 72 | uint32_t system_core_clock_get(void) 73 | { 74 | system_core_clock_update(); 75 | return system_core_clock; 76 | } 77 | -------------------------------------------------------------------------------- /tests/queue/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright 2020 ETH Zurich 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # SPDX-License-Identifier: Apache-2.0 16 | # Author: Robert Balas (balasr@iis.ee.ethz.ch) 17 | 18 | # Description: Makefile to build the blinky and other demo applications. Note 19 | # that it supports the usual GNU Make implicit variables e.g. CC, CFLAGS, 20 | # CPPFLAGS etc. Consult the GNU Make manual for move information about these. 21 | 22 | # Notes: 23 | # Useful targets 24 | # make all Compile and link 25 | # make run Simulate SoC 26 | # make backup Record your simulation run 27 | # make analyze Run analysis scripts on the simulation result 28 | 29 | # Important Variables 30 | # PROG Needs to be set to your executables name 31 | # USER_SRCS Add your source files here (use +=) 32 | # CPPFLAGS Add your include search paths and macro definitions (use +=) 33 | 34 | # For compile options check the README.md 35 | 36 | # indicate this repository's root folder 37 | PROJ_ROOT = $(shell git rev-parse --show-toplevel) 38 | 39 | # disable cluster 40 | CONFIG_CLUSTER=n 41 | 42 | # good defaults for many environment variables 43 | include $(PROJ_ROOT)/default_flags.mk 44 | 45 | # rtos and pulp sources 46 | include $(PROJ_ROOT)/default_srcs.mk 47 | 48 | # application name 49 | PROG = queue 50 | 51 | # application/user specific code 52 | USER_SRCS = queue.c 53 | 54 | # FreeRTOS.h 55 | CPPFLAGS += $(addprefix -I$(USER_DIR)/, ".") 56 | 57 | CPPFLAGS += -DportasmHANDLE_INTERRUPT=vSystemIrqHandler 58 | CPPFLAGS += -DUSE_STDIO 59 | # number of error check polls before the tests is conclueded as being successful 60 | CPPFLAGS += -DQUEUE_CHECK_ITERATIONS=2 61 | 62 | # Uncomment to disable Additional reigsters (HW Loops) 63 | #CPPFLAGS += -DportasmSKIP_ADDITIONAL_REGISTERS 64 | 65 | # compile, simulation and analysis targets 66 | include $(PROJ_ROOT)/default_targets.mk 67 | -------------------------------------------------------------------------------- /drivers/timer_irq.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 ETH Zurich and University of Bologna 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | */ 18 | 19 | /* Driver to configure PULP timer as periodic interrupt source */ 20 | /* Author: Robert Balas (balasr@iis.ee.ethz.ch) 21 | * Germain Haugou (germain.haugou@iis.ee.ethz.ch) 22 | */ 23 | 24 | #include 25 | #include 26 | 27 | #include "pulp_mem_map.h" 28 | #include "io.h" 29 | #include "bits.h" 30 | 31 | #include "timer.h" 32 | #include "timer_irq.h" 33 | 34 | int timer_irq_init(uint32_t ticks) 35 | { 36 | /* TODO: enable soc_eu timer interrupt */ 37 | 38 | /* set the interrupt interval */ 39 | timer_irq_set_timeout(ticks, false); 40 | 41 | /* We use only one of the 32-bit timer, leaving the other half available 42 | * as an additional timer. We didn't opt for using both together as 43 | * 64-bit timer. 44 | * 45 | * Enable timer, use 32khz ref clock as source. Timer will reset 46 | * automatically to zero after causing an interrupt. 47 | */ 48 | writew(TIMER_CFG_LO_ENABLE_MASK | TIMER_CFG_LO_RESET_MASK | 49 | TIMER_CFG_LO_CCFG_MASK | TIMER_CFG_LO_MODE_MASK | 50 | TIMER_CFG_LO_IRQEN_MASK, 51 | (uintptr_t)(PULP_FC_TIMER_ADDR + TIMER_CFG_LO_OFFSET)); 52 | 53 | return 0; 54 | } 55 | 56 | int timer_irq_set_timeout(uint32_t ticks, bool idle) 57 | { 58 | (void)idle; 59 | /* fast reset, value doesn't matter */ 60 | writew(1, (uintptr_t)(PULP_FC_TIMER_ADDR + TIMER_RESET_LO_OFFSET)); 61 | writew(ticks, (uintptr_t)(PULP_FC_TIMER_ADDR + TIMER_CMP_LO_OFFSET)); 62 | return 0; 63 | } 64 | 65 | /* TODO: implement */ 66 | uint32_t timer_irq_clock_elapsed() 67 | { 68 | return 0; 69 | } 70 | 71 | uint32_t timer_irq_cycle_get_32() 72 | { 73 | return readw((uintptr_t)(PULP_FC_TIMER_ADDR + TIMER_CNT_LO_OFFSET)); 74 | } 75 | -------------------------------------------------------------------------------- /tests/semaphore/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright 2020 ETH Zurich 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # SPDX-License-Identifier: Apache-2.0 16 | # Author: Robert Balas (balasr@iis.ee.ethz.ch) 17 | 18 | # Description: Makefile to build the blinky and other demo applications. Note 19 | # that it supports the usual GNU Make implicit variables e.g. CC, CFLAGS, 20 | # CPPFLAGS etc. Consult the GNU Make manual for move information about these. 21 | 22 | # Notes: 23 | # Useful targets 24 | # make all Compile and link 25 | # make run Simulate SoC 26 | # make backup Record your simulation run 27 | # make analyze Run analysis scripts on the simulation result 28 | 29 | # Important Variables 30 | # PROG Needs to be set to your executables name 31 | # USER_SRCS Add your source files here (use +=) 32 | # CPPFLAGS Add your include search paths and macro definitions (use +=) 33 | 34 | # For compile options check the README.md 35 | 36 | # indicate this repository's root folder 37 | PROJ_ROOT = $(shell git rev-parse --show-toplevel) 38 | 39 | # disable cluster 40 | CONFIG_CLUSTER=n 41 | 42 | # good defaults for many environment variables 43 | include $(PROJ_ROOT)/default_flags.mk 44 | 45 | # rtos and pulp sources 46 | include $(PROJ_ROOT)/default_srcs.mk 47 | 48 | # application name 49 | PROG = semaphore 50 | 51 | # application/user specific code 52 | USER_SRCS = semaphore.c 53 | 54 | # FreeRTOS.h 55 | CPPFLAGS += $(addprefix -I$(USER_DIR)/, ".") 56 | 57 | CPPFLAGS += -DportasmHANDLE_INTERRUPT=vSystemIrqHandler 58 | CPPFLAGS += -DUSE_STDIO 59 | ## number of error check polls before the tests is conclueded as being successful 60 | CPPFLAGS += -DSEM_CHECK_ITERATIONS=2 61 | 62 | # Uncomment to disable Additional reigsters (HW Loops) 63 | #CPPFLAGS += -DportasmSKIP_ADDITIONAL_REGISTERS 64 | 65 | # compile, simulation and analysis targets 66 | include $(PROJ_ROOT)/default_targets.mk 67 | -------------------------------------------------------------------------------- /tests/streambufferisr/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright 2020 ETH Zurich 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # SPDX-License-Identifier: Apache-2.0 16 | # Author: Robert Balas (balasr@iis.ee.ethz.ch) 17 | 18 | # Description: Makefile to build the blinky and other demo applications. Note 19 | # that it supports the usual GNU Make implicit variables e.g. CC, CFLAGS, 20 | # CPPFLAGS etc. Consult the GNU Make manual for move information about these. 21 | 22 | # Notes: 23 | # Useful targets 24 | # make all Compile and link 25 | # make run Simulate SoC 26 | # make backup Record your simulation run 27 | # make analyze Run analysis scripts on the simulation result 28 | 29 | # Important Variables 30 | # PROG Needs to be set to your executables name 31 | # USER_SRCS Add your source files here (use +=) 32 | # CPPFLAGS Add your include search paths and macro definitions (use +=) 33 | 34 | # For compile options check the README.md 35 | 36 | # indicate this repository's root folder 37 | PROJ_ROOT = $(shell git rev-parse --show-toplevel) 38 | 39 | # disable cluster 40 | CONFIG_CLUSTER=n 41 | 42 | # good defaults for many environment variables 43 | include $(PROJ_ROOT)/default_flags.mk 44 | 45 | # rtos and pulp sources 46 | include $(PROJ_ROOT)/default_srcs.mk 47 | 48 | # application name 49 | PROG = streambufferisr 50 | 51 | # application/user specific code 52 | USER_SRCS = streambufferisr.c 53 | 54 | # FreeRTOS.h 55 | CPPFLAGS += $(addprefix -I$(USER_DIR)/, ".") 56 | 57 | CPPFLAGS += -DportasmHANDLE_INTERRUPT=vSystemIrqHandler 58 | CPPFLAGS += -DUSE_STDIO 59 | ## number of error check polls before the tests is conclueded as being successful 60 | CPPFLAGS += -DSTREAM_CHECK_ITERATIONS=2 61 | 62 | # Uncomment to disable Additional reigsters (HW Loops) 63 | #CPPFLAGS += -DportasmSKIP_ADDITIONAL_REGISTERS 64 | 65 | # compile, simulation and analysis targets 66 | include $(PROJ_ROOT)/default_targets.mk 67 | -------------------------------------------------------------------------------- /libc/malloc/fc_l1_malloc.c: -------------------------------------------------------------------------------- 1 | #include "pmsis.h" 2 | #include "pmsis/rtos/os_frontend_api/os.h" 3 | #include "pmsis/rtos/malloc/fc_l1_malloc.h" 4 | 5 | /******************************************************************************* 6 | * Definitions 7 | ******************************************************************************/ 8 | 9 | /******************************************************************************* 10 | * Driver data 11 | *****************************************************************************/ 12 | 13 | #if (__FC_MALLOC_NATIVE__ == 0) 14 | malloc_t __fc_l1_malloc; 15 | pmsis_spinlock_t __fc_l1_malloc_spinlock; 16 | 17 | /******************************************************************************* 18 | * API implementation 19 | ******************************************************************************/ 20 | 21 | void *pi_fc_l1_malloc(int size) 22 | { 23 | void *ret_ptr; 24 | int irq = disable_irq(); 25 | ret_ptr = __malloc(&__fc_l1_malloc, size); 26 | restore_irq(irq); 27 | return ret_ptr; 28 | } 29 | 30 | void pi_fc_l1_free(void *_chunk, int size) 31 | { 32 | int irq = disable_irq(); 33 | __malloc_free(&__fc_l1_malloc, _chunk, size); 34 | restore_irq(irq); 35 | } 36 | 37 | void *pi_fc_l1_malloc_align(int size, int align) 38 | { 39 | void *ret_ptr; 40 | pmsis_spinlock_take(&__fc_l1_malloc_spinlock); 41 | ret_ptr = __malloc_align(&__fc_l1_malloc, size, align); 42 | pmsis_spinlock_release(&__fc_l1_malloc_spinlock); 43 | return ret_ptr; 44 | } 45 | 46 | void pi_fc_l1_malloc_init(void *heapstart, uint32_t heap_size) 47 | { 48 | __malloc_init(&__fc_l1_malloc, heapstart, heap_size); 49 | pmsis_spinlock_init(&__fc_l1_malloc_spinlock); 50 | } 51 | 52 | void pi_fc_l1_malloc_struct_set(malloc_t malloc_struct) 53 | { 54 | pmsis_spinlock_take(&__fc_l1_malloc_spinlock); 55 | memcpy(&__fc_l1_malloc, &malloc_struct, sizeof(malloc_t)); 56 | pmsis_spinlock_release(&__fc_l1_malloc_spinlock); 57 | } 58 | 59 | malloc_t pi_fc_l1_malloc_struct_get(void) 60 | { 61 | malloc_t malloc_struct; 62 | pmsis_spinlock_take(&__fc_l1_malloc_spinlock); 63 | memcpy(&malloc_struct,&__fc_l1_malloc, sizeof(malloc_t)); 64 | pmsis_spinlock_release(&__fc_l1_malloc_spinlock); 65 | return malloc_struct; 66 | } 67 | 68 | void pi_fc_l1_malloc_dump(void) 69 | { 70 | printf("FC L1 malloc dump:\n"); 71 | __malloc_dump(&__fc_l1_malloc); 72 | } 73 | 74 | #endif /* (__FC_MALLOC_NATIVE__ == 0) */ 75 | -------------------------------------------------------------------------------- /target/pulp/system_metal.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 ETH Zurich 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * Author: Robert Balas (balasr@iis.ee.ethz.ch) 18 | */ 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #include "system_metal_conf.h" 25 | 26 | #include "fll.h" 27 | #include "irq.h" 28 | #include "soc_eu.h" 29 | 30 | #ifndef DISABLE_WDOG 31 | #define DISABLE_WDOG 1 32 | #endif 33 | 34 | /* test some assumptions we make about compiler settings */ 35 | static_assert(sizeof(uintptr_t) == 4, 36 | "uintptr_t is not 4 bytes. Make sure you are using -mabi=ilp32*"); 37 | 38 | /* Allocate heap to special section. Note that we have no references in the 39 | * whole program to this variable (since its just here to allocate space in the 40 | * section for our heap), so when using LTO it will be removed. We force it to 41 | * stay with the "used" attribute 42 | */ 43 | __attribute__((section(".heap"), used)) uint8_t ucHeap[configTOTAL_HEAP_SIZE]; 44 | 45 | uint32_t volatile system_core_clock = DEFAULT_SYSTEM_CLOCK; 46 | 47 | /** 48 | * Board init code. Always call this before anything else. 49 | */ 50 | void system_init(void) 51 | { 52 | /* init flls */ 53 | for (int i = 0; i < ARCHI_NB_FLL; i++) { 54 | pi_fll_init(i, 0); 55 | } 56 | 57 | /* make sure irq (itc) is a good state */ 58 | pulp_irq_init(); 59 | 60 | /* mtvec is set in crt0.S */ 61 | 62 | /* deactivate all soc events as they are enabled by default */ 63 | soc_eu_event_init(); 64 | 65 | /* TODO: enable uart */ 66 | /* TODO: I$ enable*/ 67 | /* enable core level interrupt (mie) */ 68 | irq_clint_global_enable(); 69 | } 70 | 71 | // 72 | void system_core_clock_update() 73 | { 74 | system_core_clock = pi_fll_get_frequency(FLL_SOC, 0); 75 | } 76 | 77 | uint32_t system_core_clock_get(void) 78 | { 79 | system_core_clock_update(); 80 | return system_core_clock; 81 | } 82 | -------------------------------------------------------------------------------- /target/core-v-mcu/system_metal.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 ETH Zurich 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * Author: Robert Balas (balasr@iis.ee.ethz.ch) 18 | */ 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #include "system_metal_conf.h" 25 | 26 | #include "fll.h" 27 | #include "irq.h" 28 | #include "soc_eu.h" 29 | 30 | #ifndef DISABLE_WDOG 31 | #define DISABLE_WDOG 1 32 | #endif 33 | 34 | /* test some assumptions we make about compiler settings */ 35 | static_assert(sizeof(uintptr_t) == 4, 36 | "uintptr_t is not 4 bytes. Make sure you are using -mabi=ilp32*"); 37 | 38 | /* Allocate heap to special section. Note that we have no references in the 39 | * whole program to this variable (since its just here to allocate space in the 40 | * section for our heap), so when using LTO it will be removed. We force it to 41 | * stay with the "used" attribute 42 | */ 43 | __attribute__((section(".heap"), used)) uint8_t ucHeap[configTOTAL_HEAP_SIZE]; 44 | 45 | uint32_t volatile system_core_clock = DEFAULT_SYSTEM_CLOCK; 46 | 47 | /** 48 | * Board init code. Always call this before anything else. 49 | */ 50 | void system_init(void) 51 | { 52 | /* init flls */ 53 | for (int i = 0; i < ARCHI_NB_FLL; i++) { 54 | pi_fll_init(i, 0); 55 | } 56 | 57 | /* make sure irq (itc) is a good state */ 58 | pulp_irq_init(); 59 | 60 | /* mtvec is set in crt0.S */ 61 | 62 | /* deactivate all soc events as they are enabled by default */ 63 | soc_eu_event_init(); 64 | 65 | /* TODO: enable uart */ 66 | /* TODO: I$ enable*/ 67 | /* enable core level interrupt (mie) */ 68 | irq_clint_global_enable(); 69 | } 70 | 71 | // 72 | void system_core_clock_update() 73 | { 74 | system_core_clock = pi_fll_get_frequency(FLL_SOC, 0); 75 | } 76 | 77 | uint32_t system_core_clock_get(void) 78 | { 79 | system_core_clock_update(); 80 | return system_core_clock; 81 | } 82 | -------------------------------------------------------------------------------- /target/pulpissimo/system_metal.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 ETH Zurich 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * Author: Robert Balas (balasr@iis.ee.ethz.ch) 18 | */ 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #include "system_metal_conf.h" 25 | 26 | #include "fll.h" 27 | #include "irq.h" 28 | #include "soc_eu.h" 29 | 30 | #ifndef DISABLE_WDOG 31 | #define DISABLE_WDOG 1 32 | #endif 33 | 34 | /* test some assumptions we make about compiler settings */ 35 | static_assert(sizeof(uintptr_t) == 4, 36 | "uintptr_t is not 4 bytes. Make sure you are using -mabi=ilp32*"); 37 | 38 | /* Allocate heap to special section. Note that we have no references in the 39 | * whole program to this variable (since its just here to allocate space in the 40 | * section for our heap), so when using LTO it will be removed. We force it to 41 | * stay with the "used" attribute 42 | */ 43 | __attribute__((section(".heap"), used)) uint8_t ucHeap[configTOTAL_HEAP_SIZE]; 44 | 45 | uint32_t volatile system_core_clock = DEFAULT_SYSTEM_CLOCK; 46 | 47 | /** 48 | * Board init code. Always call this before anything else. 49 | */ 50 | void system_init(void) 51 | { 52 | /* init flls */ 53 | for (int i = 0; i < ARCHI_NB_FLL; i++) { 54 | pi_fll_init(i, 0); 55 | } 56 | 57 | /* make sure irq (itc) is a good state */ 58 | pulp_irq_init(); 59 | 60 | /* mtvec is set in crt0.S */ 61 | 62 | /* deactivate all soc events as they are enabled by default */ 63 | soc_eu_event_init(); 64 | 65 | /* TODO: enable uart */ 66 | /* TODO: I$ enable*/ 67 | /* enable core level interrupt (mie) */ 68 | irq_clint_global_enable(); 69 | } 70 | 71 | // 72 | void system_core_clock_update() 73 | { 74 | system_core_clock = pi_fll_get_frequency(FLL_SOC, 0); 75 | } 76 | 77 | uint32_t system_core_clock_get(void) 78 | { 79 | system_core_clock_update(); 80 | return system_core_clock; 81 | } 82 | -------------------------------------------------------------------------------- /drivers/include/soc_eu_metal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 ETH Zurich and University of Bologna 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | */ 18 | 19 | /* Author: Robert Balas (balasr@iis.ee.ethz.ch) 20 | * Germain Haugou (germain.haugou@iis.ee.ethz.ch) 21 | */ 22 | 23 | #ifndef __SOC_EU_H 24 | #define __SOC_EU_H 25 | /* 26 | * SOC EVENTS 27 | */ 28 | 29 | #define SOC_EU_EVENT 0x00 30 | #define SOC_FC_FIRST_MASK 0x04 31 | #define SOC_CL_FIRST_MASK 0x24 32 | #define SOC_PR_FIRST_MASK 0x44 33 | #define SOC_ERR_FIRST_MASK 0x64 34 | #define SOC_TIMER_SEL_HI 0x84 35 | #define SOC_TIMER_SEL_LO 0x88 36 | 37 | #define SOC_EU_EVENT_0 0x1 38 | #define SOC_EU_EVENT_1 0x2 39 | #define SOC_EU_EVENT_2 0x4 40 | #define SOC_EU_EVENT_3 0x8 41 | #define SOC_EU_EVENT_4 0x10 42 | #define SOC_EU_EVENT_5 0x20 43 | #define SOC_EU_EVENT_6 0x40 44 | #define SOC_EU_EVENT_7 0x80 45 | 46 | #define SOC_TIMER_SEL_ENABLE_SHIFT 31 47 | #define SOC_TIMER_SEL_EVT_SHIFT 0 48 | #define SOC_TIMER_SEL_EVT_WIDTH 8 49 | #define SOC_TIMER_SEL_EVT_MASK ((~0U) >> (32 - SOC_TIMER_SEL_EVT_WIDTH)) 50 | // #define SOC_TIMER_SEL_EVT_MASK 0xff 51 | 52 | #define SOC_TIMER_SEL_ENABLE_DISABLED 0 53 | #define SOC_TIMER_SEL_ENABLE_ENABLED 1 54 | 55 | #define SOC_TIMER_SEL_ENABLE_DIS (0 << SOC_TIMER_SEL_ENABLE_SHIFT) 56 | #define SOC_TIMER_SEL_ENABLE_ENA (1 << SOC_TIMER_SEL_ENABLE_SHIFT) 57 | #define SOC_TIMER_SEL_EVT_VAL(val) ((val) << SOC_TIMER_SEL_EVT_SHIFT) 58 | 59 | // related to XX_FIRST_MASK registers 60 | #define SOC_NB_EVENT_REGS 8 61 | #define SOC_NB_EVENT_TARGETS 3 62 | 63 | #define SOC_FC_MASK(x) (SOC_FC_FIRST_MASK + (x)*4) 64 | #define SOC_CL_MASK(x) (SOC_CL_FIRST_MASK + (x)*4) 65 | #define SOC_PR_MASK(x) (SOC_PR_FIRST_MASK + (x)*4) 66 | 67 | void soc_eu_mask_set(uint32_t offset, uint32_t mask); 68 | 69 | uint32_t soc_eu_mask_get(uint32_t offset); 70 | 71 | void soc_eu_event_init(); 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /template/hello_world/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2020 ETH Zurich 2 | # 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy 4 | # of this software and associated documentation files (the "Software"), to deal 5 | # in the Software without restriction, including without limitation the rights 6 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | # copies of the Software, and to permit persons to whom the Software is 8 | # furnished to do so, subject to the following conditions: 9 | # 10 | # The above copyright notice and this permission notice shall be included in all 11 | # copies or substantial portions of the Software. 12 | # 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | # SOFTWARE. 20 | # 21 | # SPDX-License-Identifier: MIT 22 | # Author: Robert Balas (balasr@iis.ee.ethz.ch) 23 | 24 | 25 | # Description: Makefile to build the blinky and other demo applications. Note 26 | # that it supports the usual GNU Make implicit variables e.g. CC, CFLAGS, 27 | # CPPFLAGS etc. Consult the GNU Make manual for move information about these. 28 | 29 | # Notes: 30 | # Useful targets 31 | # run make help for an updated overview 32 | 33 | # For compile options check the README.md 34 | 35 | # indicate this repository's root folder 36 | # set some project specific path variables 37 | ifndef FREERTOS_PROJ_ROOT 38 | $(error "FREERTOS_PROJ_ROOT is unset. Run source env/platform-you-want.sh \ 39 | from the freertos project's root folder.") 40 | endif 41 | 42 | # withouth kernel 43 | CONFIG_FREERTOS_KERNEL=n 44 | 45 | # good defaults for many environment variables 46 | include $(FREERTOS_PROJ_ROOT)/default_flags.mk 47 | 48 | # rtos and pulp sources, minimal 49 | include $(FREERTOS_PROJ_ROOT)/default_srcs.mk 50 | 51 | # application name 52 | PROG = helloworld 53 | 54 | # application/user specific code 55 | USER_SRCS = helloworld.c 56 | 57 | # system_metal_conf.h 58 | CPPFLAGS += $(addprefix -I$(USER_DIR)/, ".") 59 | 60 | CPPFLAGS += -DportasmHANDLE_INTERRUPT=undefined_handler 61 | 62 | # compile, simulation and analysis targets 63 | include $(FREERTOS_PROJ_ROOT)/default_targets.mk 64 | -------------------------------------------------------------------------------- /target/arch/io.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 ETH Zurich 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * Author: Robert Balas (balasr@iis.ee.ethz.ch) 18 | */ 19 | 20 | /* Description: Register I/O access 21 | */ 22 | 23 | #ifndef __IO_H 24 | #define __IO_H 25 | 26 | #include 27 | 28 | /* generic I/O write */ 29 | static inline void writeb(uint8_t val, uintptr_t addr) 30 | { 31 | asm volatile("sb %0, 0(%1)" 32 | : 33 | : "r"(val), "r"((volatile uint8_t *)addr)); 34 | } 35 | 36 | static inline void writeh(uint16_t val, uintptr_t addr) 37 | { 38 | asm volatile("sh %0, 0(%1)" 39 | : 40 | : "r"(val), "r"((volatile uint16_t *)addr)); 41 | } 42 | 43 | static inline void writew(uint32_t val, uintptr_t addr) 44 | { 45 | asm volatile("sw %0, 0(%1)" 46 | : 47 | : "r"(val), "r"((volatile uint32_t *)addr)); 48 | } 49 | 50 | static inline void writed(uint64_t val, uintptr_t addr) 51 | { 52 | asm volatile("sd %0, 0(%1)" 53 | : 54 | : "r"(val), "r"((volatile uint64_t *)addr)); 55 | } 56 | 57 | /* generic I/O read */ 58 | static inline uint8_t readb(const uintptr_t addr) 59 | { 60 | uint8_t val; 61 | 62 | asm volatile("lb %0, 0(%1)" 63 | : "=r"(val) 64 | : "r"((const volatile uint8_t *)addr)); 65 | return val; 66 | } 67 | 68 | static inline uint16_t readh(const uintptr_t addr) 69 | { 70 | uint16_t val; 71 | 72 | asm volatile("lh %0, 0(%1)" 73 | : "=r"(val) 74 | : "r"((const volatile uint16_t *)addr)); 75 | return val; 76 | } 77 | 78 | static inline uint32_t readw(const uintptr_t addr) 79 | { 80 | uint32_t val; 81 | 82 | asm volatile("lw %0, 0(%1)" 83 | : "=r"(val) 84 | : "r"((const volatile uint32_t *)addr)); 85 | return val; 86 | } 87 | 88 | static inline uint64_t readd(const uintptr_t addr) 89 | { 90 | uint64_t val; 91 | 92 | asm volatile("ld %0, 0(%1)" 93 | : "=r"(val) 94 | : "r"((const volatile uint64_t *)addr)); 95 | return val; 96 | } 97 | #endif 98 | -------------------------------------------------------------------------------- /libc/malloc/l2_malloc.c: -------------------------------------------------------------------------------- 1 | #include "pmsis.h" 2 | #include "pmsis/rtos/os_frontend_api/os.h" 3 | #include "pmsis/rtos/malloc/l2_malloc.h" 4 | 5 | /******************************************************************************* 6 | * Definitions 7 | ******************************************************************************/ 8 | 9 | /******************************************************************************* 10 | * Driver data 11 | *****************************************************************************/ 12 | 13 | #if (__PMSIS_L2_MALLOC_NATIVE__ == 0) 14 | malloc_t __l2_malloc; 15 | pmsis_spinlock_t __l2_malloc_spinlock; 16 | 17 | /******************************************************************************* 18 | * API implementation 19 | ******************************************************************************/ 20 | 21 | void *pi_l2_malloc(int size) 22 | { 23 | void *ret_ptr; 24 | pmsis_spinlock_take(&__l2_malloc_spinlock); 25 | ret_ptr = __malloc(&__l2_malloc, size); 26 | pmsis_spinlock_release(&__l2_malloc_spinlock); 27 | if(ret_ptr == NULL) 28 | { 29 | printf("Malloc failed\n"); 30 | } 31 | return ret_ptr; 32 | } 33 | 34 | void pi_l2_free(void *_chunk, int size) 35 | { 36 | pmsis_spinlock_take(&__l2_malloc_spinlock); 37 | __malloc_free(&__l2_malloc, _chunk, size); 38 | pmsis_spinlock_release(&__l2_malloc_spinlock); 39 | } 40 | 41 | void *pi_l2_malloc_align(int size, int align) 42 | { 43 | void *ret_ptr; 44 | pmsis_spinlock_take(&__l2_malloc_spinlock); 45 | ret_ptr = __malloc_align(&__l2_malloc, size, align); 46 | pmsis_spinlock_release(&__l2_malloc_spinlock); 47 | return ret_ptr; 48 | } 49 | 50 | void pi_l2_malloc_init(void *heapstart, uint32_t heap_size) 51 | { 52 | __malloc_init(&__l2_malloc, heapstart, heap_size); 53 | pmsis_spinlock_init(&__l2_malloc_spinlock); 54 | } 55 | 56 | void pi_l2_malloc_struct_set(malloc_t malloc_struct) 57 | { 58 | pmsis_spinlock_take(&__l2_malloc_spinlock); 59 | memcpy(&__l2_malloc,&malloc_struct,sizeof(malloc_t)); 60 | pmsis_spinlock_release(&__l2_malloc_spinlock); 61 | } 62 | 63 | malloc_t pi_l2_malloc_struct_get(void) 64 | { 65 | malloc_t malloc_struct; 66 | pmsis_spinlock_take(&__l2_malloc_spinlock); 67 | memcpy(&malloc_struct, &__l2_malloc, sizeof(malloc_t)); 68 | pmsis_spinlock_release(&__l2_malloc_spinlock); 69 | return malloc_struct; 70 | } 71 | 72 | void pi_l2_malloc_dump(void) 73 | { 74 | printf("L2 malloc dump:\n"); 75 | __malloc_dump(&__l2_malloc); 76 | } 77 | 78 | #endif /* (__PMSIS_L2_MALLOC_NATIVE__ == 0) */ 79 | -------------------------------------------------------------------------------- /scripts/README_MEM.md: -------------------------------------------------------------------------------- 1 | # mem.tcl 2 | Read, write and convert verilog style memory dumps. Mainly used with vsim and 3 | PULP/PULPissimo. You use this to 4 | 5 | - Convert verilog style memory dumps depending on your needs (addressing, word 6 | width etc.) 7 | - Dump the contents of memories during simulation (finding heap corruption bugs etc.) 8 | - Generate memory images from an executable to be preloaded by the simulator. 9 | Speeds up simulation time. 10 | 11 | ## Why TCL 12 | Simply because most EDA tools use TCL as scripting language. This makes 13 | integrating memory manipulation easier to e.g. simulators. One usecase is 14 | dumping the L2 at some point during simulation for some manipulations and then 15 | reading it back again. 16 | 17 | ## Usage 18 | ### As a library 19 | With your tclsh: 20 | ```bash 21 | tclsh 22 | source mem.tcl 23 | ``` 24 | Now first generate a verilog style dump from your elf: 25 | ```bash 26 | riscv32-unknown-elf-objcopy -O verilog my-elf mem.verilog 27 | ``` 28 | or generate it from a PULP simulation: 29 | ```tclsh 30 | pulp_dump_mem_l2 mem.verilog 31 | ``` 32 | 33 | Examples: 34 | 35 | Change word width of a memory dump 36 | ```tclsh 37 | # read into internal representation 38 | set my_dump [read_mem_dump mem.verilog] 39 | 40 | # change word width, also consider endianness 41 | set my_dump change_width_mem_dump $my_dump 1 4 "little" "big" 42 | 43 | # The addressing is still byte addressing, we need to change to word addressing 44 | # The scaling of addresses is done relativ to the base_addr 45 | set base_addr 0x1c000000 46 | set my_dump [scale_addr_mem_dump $my_dump $base_addr 1 4] 47 | 48 | # write back to a file 49 | write_mem_dump $my_dump mem4.verilog 50 | ``` 51 | 52 | ### As a script 53 | You can use `mem.tcl` as a script to generate a memory image for each bank in L2 54 | from an executable. This is mainly to bypass loading the executable via jtag 55 | during simulation, which is very slow (512 kiB takes tens of minutes to load). 56 | 57 | Usually you do something like this: 58 | ```bash 59 | riscv32-unknown-elf-objcopy -O verilog my-elf preload.verilog 60 | ./mem.tcl preload.verilog out_dir 61 | # when running the pulp/pulpissimo simulation pass the directory 62 | vsim ... +preload=out_dir 63 | ``` 64 | 65 | You might think to use the `--verilog-data-width=val` option to generate a 66 | different word width instead of using `mem.tcl` but this is broken for two 67 | reasons: 68 | 1. the wrong endianness is used (always big-endian) 69 | 2. the wrong addressing is used (byte addressing instead of `val` width specific 70 | addressing). This conversion is anyway only possible by knowing the base 71 | address of memories. 72 | -------------------------------------------------------------------------------- /tests/i2c_scan/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright 2020 ETH Zurich 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # SPDX-License-Identifier: Apache-2.0 16 | # Author: Robert Balas (balasr@iis.ee.ethz.ch) 17 | 18 | # Description: Makefile to build the blinky and other demo applications. Note 19 | # that it supports the usual GNU Make implicit variables e.g. CC, CFLAGS, 20 | # CPPFLAGS etc. Consult the GNU Make manual for move information about these. 21 | 22 | # Notes: 23 | # Useful targets 24 | # make all Compile and link 25 | # make run Simulate SoC 26 | # make backup Record your simulation run 27 | # make analyze Run analysis scripts on the simulation result 28 | 29 | # Important Variables 30 | # PROG Needs to be set to your executables name 31 | # USER_SRCS Add your source files here (use +=) 32 | # CPPFLAGS Add your include search paths and macro definitions (use +=) 33 | 34 | # For compile options check the README.md 35 | 36 | # indicate this repository's root folder 37 | PROJ_ROOT = $(shell git rev-parse --show-toplevel) 38 | 39 | # good defaults for many environment variables 40 | include $(PROJ_ROOT)/default_flags.mk 41 | 42 | # manually set CFLAGS to disable some warnings (-Wconversion) 43 | CFLAGS = \ 44 | -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore \ 45 | -fsigned-char -ffunction-sections -fdata-sections \ 46 | -std=gnu11 \ 47 | -Wall -Wextra -Wshadow -Wformat=2 -Wundef \ 48 | -Wno-unused-parameter -Wno-unused-variable \ 49 | -Og -g3 \ 50 | -D__PULP__=1 -DDEBUG \ 51 | -Wstack-usage=1024 52 | 53 | CONFIG_CLUSTER=n 54 | # rtos, pulp and pmsis sources 55 | include $(PROJ_ROOT)/default_srcs.mk 56 | 57 | # application name 58 | PROG = i2c_scan 59 | 60 | # application/user specific code 61 | USER_SRCS = i2c_scan.c 62 | 63 | # FreeRTOS.h 64 | CPPFLAGS += $(addprefix -I$(USER_DIR)/, ".") 65 | 66 | CPPFLAGS += -DportasmHANDLE_INTERRUPT=vSystemIrqHandler 67 | 68 | # Uncomment to disable Additional reigsters (HW Loops) 69 | #CPPFLAGS += -DportasmSKIP_ADDITIONAL_REGISTERS 70 | 71 | # compile, simulation and analysis targets 72 | include $(PROJ_ROOT)/default_targets.mk 73 | -------------------------------------------------------------------------------- /default_srcs.mk: -------------------------------------------------------------------------------- 1 | # Copyright 2020 ETH Zurich 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # SPDX-License-Identifier: Apache-2.0 16 | # Author: Robert Balas (balasr@iis.ee.ethz.ch) 17 | 18 | # expects RTOS_ROOT to point to the FreeRTOS distribution root 19 | # and COMMON_ROOT to the driver folder 20 | 21 | # general OS 22 | ifeq ($(CONFIG_FREERTOS_KERNEL),y) 23 | dir := kernel 24 | 25 | SRCS += $(dir)/event_groups.c 26 | SRCS += $(dir)/list.c 27 | SRCS += $(dir)/queue.c 28 | SRCS += $(dir)/stream_buffer.c 29 | SRCS += $(dir)/tasks.c 30 | SRCS += $(dir)/timers.c 31 | # RISC-V port files 32 | SRCS += $(dir)/portable/GCC/RISC-V/port.c 33 | SRCS += $(dir)/portable/GCC/RISC-V/portASM.S 34 | # memory managment 35 | SRCS += $(dir)/portable/MemMang/heap_3.c 36 | # freertos macro 37 | CV_CPPFLAGS += -DCONFIG_FREERTOS_KERNEL 38 | # freertos generic headers 39 | CV_CPPFLAGS += -I"$(FREERTOS_PROJ_ROOT)/$(dir)/include" 40 | CV_CPPFLAGS += -I"$(FREERTOS_PROJ_ROOT)/$(dir)/portable/GCC/RISC-V" 41 | # freertos header for assembler 42 | ifeq ($(CONFIG_FREERTOS_CHIP_INCLUDE),) 43 | $(error "CONFIG_FREERTOS_CHIP_INCLUDE is unset. Set to your target platform. See README.md.") 44 | endif 45 | CV_CPPFLAGS += -I"$(FREERTOS_PROJ_ROOT)/$(dir)/portable/GCC/RISC-V/chip_specific_extensions/$(CONFIG_FREERTOS_CHIP_INCLUDE)" 46 | endif 47 | 48 | # arch (RISC-V) specific 49 | dir := target/arch 50 | include $(FREERTOS_PROJ_ROOT)/$(dir)/makefile.mk 51 | 52 | # c runtime and init 53 | ifeq ($(CONFIG_USE_NEWLIB),y) 54 | # syscall shims / implementation 55 | dir := libc 56 | include $(FREERTOS_PROJ_ROOT)/$(dir)/makefile.mk 57 | endif 58 | 59 | # metal drivers and runtime 60 | # target dependend files 61 | dir := target/$(CONFIG_TARGET) 62 | include $(FREERTOS_PROJ_ROOT)/$(dir)/makefile.mk 63 | 64 | # drivers 65 | # TODO: currently the drivers are not properly decoupled from the kernel so we 66 | # depend on the kernel until this is fixed 67 | dir := drivers 68 | ifeq ($(CONFIG_FREERTOS_KERNEL),y) 69 | include $(FREERTOS_PROJ_ROOT)/$(dir)/makefile.mk 70 | else 71 | # TODO: this part of the workaround above 72 | CV_CPPFLAGS += -I$(FREERTOS_PROJ_ROOT)/$(dir)/include 73 | endif 74 | -------------------------------------------------------------------------------- /drivers/include/bits.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011-2014, Wind River Systems, Inc. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | /* 8 | * Copyright 2020 ETH Zurich 9 | * 10 | * Licensed under the Apache License, Version 2.0 (the "License"); 11 | * you may not use this file except in compliance with the License. 12 | * You may obtain a copy of the License at 13 | * 14 | * http://www.apache.org/licenses/LICENSE-2.0 15 | * 16 | * Unless required by applicable law or agreed to in writing, software 17 | * distributed under the License is distributed on an "AS IS" BASIS, 18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | * See the License for the specific language governing permissions and 20 | * limitations under the License. 21 | * 22 | * Author: Robert Balas (balasr@iis.ee.ethz.ch) 23 | */ 24 | 25 | #ifndef __BITS_H 26 | #define __BITS_H 27 | 28 | #include 29 | 30 | /* Helper to pass a int as a pointer or vice-versa. */ 31 | #define POINTER_TO_UINT(x) ((uintptr_t) (x)) 32 | #define UINT_TO_POINTER(x) ((void *) (uintptr_t) (x)) 33 | #define POINTER_TO_INT(x) ((intptr_t) (x)) 34 | #define INT_TO_POINTER(x) ((void *) (intptr_t) (x)) 35 | 36 | #if !(defined (__CHAR_BIT__) && defined (__SIZEOF_LONG__)) 37 | # error Missing required predefined macros for BITS_PER_LONG calculation 38 | #endif 39 | 40 | #define BITS_PER_LONG (__CHAR_BIT__ * __SIZEOF_LONG__) 41 | /* Create a contiguous bitmask starting at bit position @l and ending at 42 | * position @h. 43 | */ 44 | #define GENMASK(h, l) \ 45 | (((~0UL) - (1UL << (l)) + 1) & (~0UL >> (BITS_PER_LONG - 1 - (h)))) 46 | 47 | /* KB, MB, GB */ 48 | #define KB(x) ((x) << 10) 49 | #define MB(x) (KB(x) << 10) 50 | #define GB(x) (MB(x) << 10) 51 | 52 | /* KHZ, MHZ */ 53 | #define KHZ(x) ((x) * 1000) 54 | #define MHZ(x) (KHZ(x) * 1000) 55 | 56 | #ifndef BIT 57 | #if defined(_ASMLANGUAGE) 58 | #define BIT(n) (1 << (n)) 59 | #else 60 | #define BIT(n) (1UL << (n)) 61 | #endif 62 | #endif 63 | 64 | /** 65 | * @brief Macro sets or clears bit depending on boolean value 66 | * 67 | * @param var Variable to be altered 68 | * @param bit Bit number 69 | * @param set Value 0 clears bit, any other value sets bit 70 | */ 71 | #define WRITE_BIT(var, bit, set) \ 72 | ((var) = (set) ? ((var) | BIT(bit)) : ((var) & ~BIT(bit))) 73 | 74 | #define BIT_MASK(n) (BIT(n) - 1) 75 | 76 | 77 | /** 78 | * @brief Convenience macro reads or sets register fields 79 | * 80 | * @param FIELD Register name 81 | * @param v value of bits 82 | */ 83 | #define REG_SET(FIELD, v) (((v) << FIELD##_SHIFT) & FIELD##_MASK) 84 | #define REG_GET(FIELD, v) (((v) & FIELD##_MASK) >> FIELD##_SHIFT) 85 | 86 | #endif 87 | -------------------------------------------------------------------------------- /drivers/fc_event.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 GreenWaves Technologies 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | */ 18 | 19 | #include 20 | #include 21 | #include "fc_event.h" 22 | #include "memory_map.h" 23 | #include "pulp_mem_map.h" 24 | #include "riscv.h" 25 | #ifdef CONFIG_CLIC 26 | #include "clic.h" 27 | #endif 28 | 29 | 30 | static void fc_event_null_event(void *arg); 31 | 32 | static volatile pi_fc_event_handler_t fc_event_handlers[NB_SOC_EVENTS]; 33 | 34 | static void fc_event_null_event(void *arg) 35 | { 36 | return; 37 | } 38 | 39 | void pi_fc_event_handler_init(uint32_t fc_event_irq) 40 | { 41 | /* TODO: fix this mess, that should be 8 32-bit writes */ 42 | /* open the mask for fc_soc_event irq */ 43 | for (int i = 0; i < NB_SOC_EVENTS; i++) { 44 | pi_fc_event_handler_clear((uint32_t)i); 45 | } 46 | irq_enable((int)fc_event_irq); 47 | #ifdef CONFIG_CLIC 48 | irq_set_trigger_type((int)fc_event_irq, CLIC_TRIG_LEVEL | CLIC_TRIG_POSITIVE); 49 | #endif 50 | } 51 | 52 | void pi_fc_event_handler_set(uint32_t event_id, 53 | pi_fc_event_handler_t event_handler) 54 | { 55 | fc_event_handlers[event_id] = event_handler; 56 | } 57 | 58 | void pi_fc_event_handler_clear(uint32_t event_id) 59 | { 60 | fc_event_handlers[event_id] = 61 | (pi_fc_event_handler_t)fc_event_null_event; 62 | } 63 | 64 | /* TODO: fix */ 65 | __attribute__((section(".text"))) void fc_soc_event_handler(void) 66 | { 67 | uint32_t event = 0; 68 | /* When we are using the clic, we don't have the SIMPLE_IRQ FIFO 69 | * register anymore. Instead, we have a minimal event_to_level_int 70 | * convertor that takes over the role of generating a level sensitive 71 | * interrupt on the CLIC and contains a small register storing the event 72 | * data. This data needs to be read to clear the interrupt */ 73 | #ifdef CONFIG_CLIC 74 | event = readw((uintptr_t)PULP_EVENT_TO_INT_ADDR); 75 | #else 76 | /* Pop one event element from the FIFO */ 77 | event = SIMPLE_IRQ->FIFO; 78 | #endif 79 | event &= 0xff; 80 | 81 | /* redirect to handler with jump table */ 82 | if (fc_event_handlers[event] != NULL) { 83 | fc_event_handlers[event]((void *)event); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /template/blinky/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2020 ETH Zurich 2 | # 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy 4 | # of this software and associated documentation files (the "Software"), to deal 5 | # in the Software without restriction, including without limitation the rights 6 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | # copies of the Software, and to permit persons to whom the Software is 8 | # furnished to do so, subject to the following conditions: 9 | # 10 | # The above copyright notice and this permission notice shall be included in all 11 | # copies or substantial portions of the Software. 12 | # 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | # SOFTWARE. 20 | # 21 | # SPDX-License-Identifier: MIT 22 | # Author: Robert Balas (balasr@iis.ee.ethz.ch) 23 | 24 | # Description: Makefile to build the blinky and other demo applications. Note 25 | # that it supports the usual GNU Make implicit variables e.g. CC, CFLAGS, 26 | # CPPFLAGS etc. Consult the GNU Make manual for move information about these. 27 | 28 | # Notes: 29 | # Useful targets 30 | # run make help for an updated overview 31 | 32 | # Important Variables 33 | # PROG Needs to be set to your executables name 34 | # USER_SRCS Add your source files here (use +=) 35 | # CPPFLAGS Add your include search paths and macro definitions (use +=) 36 | 37 | # For compile options check the README.md 38 | 39 | # indicate this repository's root folder 40 | # set some project specific path variables 41 | ifndef FREERTOS_PROJ_ROOT 42 | $(error "FREERTOS_PROJ_ROOT is unset. Run `source env/platform-you-want.sh' \ 43 | from the freertos project's root folder.") 44 | endif 45 | 46 | # good defaults for many environment variables 47 | include $(FREERTOS_PROJ_ROOT)/default_flags.mk 48 | 49 | # rtos and pulp sources 50 | include $(FREERTOS_PROJ_ROOT)/default_srcs.mk 51 | 52 | # application name 53 | PROG = blinky 54 | 55 | # application/user specific code 56 | USER_SRCS = main.c blinky_demo/main_blinky.c 57 | 58 | # user headers 59 | CPPFLAGS += $(addprefix -I$(USER_DIR)/, ".") 60 | 61 | # point to irq handler 62 | CPPFLAGS += -DportasmHANDLE_INTERRUPT=vSystemIrqHandler 63 | CPPFLAGS += -DmainCREATE_SIMPLE_BLINKY_DEMO_ONLY=1 64 | 65 | # compile, simulation and analysis targets 66 | include $(FREERTOS_PROJ_ROOT)/default_targets.mk 67 | -------------------------------------------------------------------------------- /drivers/include/cluster/cl_idma_archi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 ETH Zurich and University of Bologna 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __ARCHI_IDMA_V1_H__ 18 | #define __ARCHI_IDMA_V1_H__ 19 | 20 | // Generated register defines for idma_reg32_2d_frontend 21 | 22 | #ifndef _IDMA_REG32_2D_FRONTEND_REG_DEFS_ 23 | #define _IDMA_REG32_2D_FRONTEND_REG_DEFS_ 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | // Register width 29 | #define IDMA_REG32_2D_FRONTEND_PARAM_REG_WIDTH 32 30 | 31 | // Source Address 32 | #define IDMA_REG32_2D_FRONTEND_SRC_ADDR_REG_OFFSET 0x0 33 | 34 | // Destination Address 35 | #define IDMA_REG32_2D_FRONTEND_DST_ADDR_REG_OFFSET 0x4 36 | 37 | // Number of bytes 38 | #define IDMA_REG32_2D_FRONTEND_NUM_BYTES_REG_OFFSET 0x8 39 | 40 | // Configuration Register for DMA settings 41 | #define IDMA_REG32_2D_FRONTEND_CONF_REG_OFFSET 0xc 42 | #define IDMA_REG32_2D_FRONTEND_CONF_DECOUPLE_BIT 0 43 | #define IDMA_REG32_2D_FRONTEND_CONF_DEBURST_BIT 1 44 | #define IDMA_REG32_2D_FRONTEND_CONF_SERIALIZE_BIT 2 45 | #define IDMA_REG32_2D_FRONTEND_CONF_TWOD_BIT 3 46 | 47 | // Source Stride 48 | #define IDMA_REG32_2D_FRONTEND_STRIDE_SRC_REG_OFFSET 0x10 49 | 50 | // Destination Stride 51 | #define IDMA_REG32_2D_FRONTEND_STRIDE_DST_REG_OFFSET 0x14 52 | 53 | // Number of 2D repetitions 54 | #define IDMA_REG32_2D_FRONTEND_NUM_REPETITIONS_REG_OFFSET 0x18 55 | 56 | // DMA Status 57 | #define IDMA_REG32_2D_FRONTEND_STATUS_REG_OFFSET 0x1c 58 | #define IDMA_REG32_2D_FRONTEND_STATUS_BUSY_MASK 0xffff 59 | #define IDMA_REG32_2D_FRONTEND_STATUS_BUSY_OFFSET 0 60 | #define IDMA_REG32_2D_FRONTEND_STATUS_BUSY_FIELD \ 61 | ((bitfield_field32_t) { .mask = IDMA_REG32_2D_FRONTEND_STATUS_BUSY_MASK, .index = IDMA_REG32_2D_FRONTEND_STATUS_BUSY_OFFSET }) 62 | 63 | // Next ID, launches transfer, returns 0 if transfer not set up properly. 64 | #define IDMA_REG32_2D_FRONTEND_NEXT_ID_REG_OFFSET 0x20 65 | 66 | // Get ID of finished transactions. 67 | #define IDMA_REG32_2D_FRONTEND_DONE_REG_OFFSET 0x24 68 | 69 | #ifdef __cplusplus 70 | } // extern "C" 71 | #endif 72 | #endif // _IDMA_REG32_2D_FRONTEND_REG_DEFS_ 73 | // End generated register defines for idma_reg32_2d_frontend 74 | 75 | #endif // __ARCHI_IDMA_V1_H__ 76 | -------------------------------------------------------------------------------- /tests/uart/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright 2020 ETH Zurich 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # SPDX-License-Identifier: Apache-2.0 16 | # Author: Robert Balas (balasr@iis.ee.ethz.ch) 17 | 18 | # Description: Makefile to build the blinky and other demo applications. Note 19 | # that it supports the usual GNU Make implicit variables e.g. CC, CFLAGS, 20 | # CPPFLAGS etc. Consult the GNU Make manual for move information about these. 21 | 22 | # Notes: 23 | # Useful targets 24 | # make all Compile and link 25 | # make run Simulate SoC 26 | # make backup Record your simulation run 27 | # make analyze Run analysis scripts on the simulation result 28 | 29 | # Important Variables 30 | # PROG Needs to be set to your executables name 31 | # USER_SRCS Add your source files here (use +=) 32 | # CPPFLAGS Add your include search paths and macro definitions (use +=) 33 | 34 | # For compile options check the README.md 35 | 36 | # indicate this repository's root folder 37 | PROJ_ROOT = $(shell git rev-parse --show-toplevel) 38 | 39 | # good defaults for many environment variables 40 | include $(PROJ_ROOT)/default_flags.mk 41 | 42 | # manually set CFLAGS to disable some warnings (-Wconversion) 43 | CFLAGS = \ 44 | -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore \ 45 | -fsigned-char -ffunction-sections -fdata-sections \ 46 | -std=gnu11 \ 47 | -Wall -Wextra -Wshadow -Wformat=2 -Wundef \ 48 | -Wno-unused-parameter -Wno-unused-variable \ 49 | -Og -g3 \ 50 | -DASYNC=0 51 | 52 | 53 | # disable cluster 54 | CONFIG_CLUSTER=n 55 | 56 | # rtos, pulp and pmsis sources 57 | include $(PROJ_ROOT)/default_srcs.mk 58 | 59 | # application name 60 | PROG = uart_test 61 | 62 | # application/user specific code 63 | USER_SRCS = uart_test.c 64 | 65 | # FreeRTOS.h 66 | CPPFLAGS += $(addprefix -I$(USER_DIR)/, ".") 67 | 68 | CPPFLAGS += -DportasmHANDLE_INTERRUPT=vSystemIrqHandler 69 | CPPFLAGS += -DUSE_STDIO 70 | ## number of error check polls before the tests is conclueded as being successful 71 | CPPFLAGS += -DSTREAM_CHECK_ITERATIONS=2 72 | 73 | # Uncomment to disable Additional reigsters (HW Loops) 74 | #CPPFLAGS += -DportasmSKIP_ADDITIONAL_REGISTERS 75 | 76 | # compile, simulation and analysis targets 77 | include $(PROJ_ROOT)/default_targets.mk 78 | -------------------------------------------------------------------------------- /tests/cluster/cluster_fork/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright 2020 ETH Zurich 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # SPDX-License-Identifier: Apache-2.0 16 | # Author: Robert Balas (balasr@iis.ee.ethz.ch) 17 | 18 | # Description: Makefile to build the blinky and other demo applications. Note 19 | # that it supports the usual GNU Make implicit variables e.g. CC, CFLAGS, 20 | # CPPFLAGS etc. Consult the GNU Make manual for move information about these. 21 | 22 | # Notes: 23 | # Useful targets 24 | # make all Compile and link 25 | # make run Simulate SoC 26 | # make backup Record your simulation run 27 | # make analyze Run analysis scripts on the simulation result 28 | 29 | # Important Variables 30 | # PROG Needs to be set to your executables name 31 | # USER_SRCS Add your source files here (use +=) 32 | # CPPFLAGS Add your include search paths and macro definitions (use +=) 33 | 34 | # For compile options check the README.md 35 | 36 | # indicate this repository's root folder 37 | PROJ_ROOT = $(shell git rev-parse --show-toplevel) 38 | 39 | # good defaults for many environment variables 40 | include $(PROJ_ROOT)/default_flags.mk 41 | 42 | # manually set CFLAGS to disable some warnings (-Wconversion) 43 | CFLAGS = \ 44 | -march=rv32imac_xcorev -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore \ 45 | -fsigned-char -ffunction-sections -fdata-sections \ 46 | -std=gnu11 \ 47 | -Wall -Wextra -Wshadow -Wformat=2 -Wundef \ 48 | -Wno-unused-parameter -Wno-unused-variable \ 49 | -Og -g3 \ 50 | -DFEATURE_CLUSTER=1 -D__PULP__=1 -DDEBUG \ 51 | -fstack-usage -Wstack-usage=1024 -Wno-sign-conversion 52 | 53 | ASFLAGS = -Os -g3 -march=rv32imac_xcorev -mabi=ilp32 54 | 55 | # rtos, pulp and pmsis sources 56 | include $(PROJ_ROOT)/default_srcs.mk 57 | 58 | # application name 59 | PROG = cluster_fork 60 | 61 | # application/user specific code 62 | USER_SRCS = cluster_fork.c 63 | 64 | # FreeRTOS.h 65 | CPPFLAGS += $(addprefix -I$(USER_DIR)/, ".") 66 | 67 | CPPFLAGS += -DportasmHANDLE_INTERRUPT=vSystemIrqHandler 68 | CPPFLAGS += -DUSE_STDIO 69 | 70 | # Uncomment to disable Additional reigsters (HW Loops) 71 | CPPFLAGS += -DportasmSKIP_ADDITIONAL_REGISTERS 72 | 73 | # compile, simulation and analysis targets 74 | include $(PROJ_ROOT)/default_targets.mk 75 | -------------------------------------------------------------------------------- /tests/i2c_eeprom/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright 2020 ETH Zurich 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # SPDX-License-Identifier: Apache-2.0 16 | # Author: Robert Balas (balasr@iis.ee.ethz.ch) 17 | 18 | # Description: Makefile to build the blinky and other demo applications. Note 19 | # that it supports the usual GNU Make implicit variables e.g. CC, CFLAGS, 20 | # CPPFLAGS etc. Consult the GNU Make manual for move information about these. 21 | 22 | # Notes: 23 | # Useful targets 24 | # make all Compile and link 25 | # make run Simulate SoC 26 | # make backup Record your simulation run 27 | # make analyze Run analysis scripts on the simulation result 28 | 29 | # Important Variables 30 | # PROG Needs to be set to your executables name 31 | # USER_SRCS Add your source files here (use +=) 32 | # CPPFLAGS Add your include search paths and macro definitions (use +=) 33 | 34 | # For compile options check the README.md 35 | 36 | # indicate this repository's root folder 37 | PROJ_ROOT = $(shell git rev-parse --show-toplevel) 38 | 39 | # good defaults for many environment variables 40 | include $(PROJ_ROOT)/default_flags.mk 41 | 42 | # manually set CFLAGS to disable some warnings (-Wconversion) 43 | CFLAGS = \ 44 | -march=rv32imac -mabi=ilp32 -msmall-data-limit=8 -mno-save-restore \ 45 | -fsigned-char -ffunction-sections -fdata-sections \ 46 | -std=gnu11 \ 47 | -Wall -Wextra -Wshadow -Wformat=2 -Wundef \ 48 | -Wno-unused-parameter -Wno-unused-variable \ 49 | -Og -g3 \ 50 | -D__PULP__=1 -DDEBUG \ 51 | -Wstack-usage=1024 52 | 53 | CONFIG_CLUSTER=n 54 | # rtos, pulp and pmsis sources 55 | include $(PROJ_ROOT)/default_srcs.mk 56 | 57 | # application name 58 | PROG = i2c_eeprom 59 | 60 | # application/user specific code 61 | USER_SRCS = i2c_eeprom.c 62 | 63 | # FreeRTOS.h 64 | CPPFLAGS += $(addprefix -I$(USER_DIR)/, ".") 65 | 66 | CPPFLAGS += -DportasmHANDLE_INTERRUPT=vSystemIrqHandler 67 | CPPFLAGS += -DUSE_STDIO 68 | ## number of error check polls before the tests is conclueded as being successful 69 | CPPFLAGS += -DSTREAM_CHECK_ITERATIONS=2 70 | 71 | # Uncomment to disable Additional reigsters (HW Loops) 72 | #CPPFLAGS += -DportasmSKIP_ADDITIONAL_REGISTERS 73 | 74 | # compile, simulation and analysis targets 75 | include $(PROJ_ROOT)/default_targets.mk 76 | --------------------------------------------------------------------------------