From c699bcb17e7a73de3e34c0b234a478fa8eb8d402 Mon Sep 17 00:00:00 2001 From: dwf1m12 <d.w.flynn@soton.ac.uk> Date: Mon, 10 Jul 2023 20:16:46 +0100 Subject: [PATCH] ADP v4 confidence test added --- system/testcodes/adp_v4_cmd_tests/adp.cmd | 68 +++++ .../adp_v4_cmd_tests/adp_v4_cmd_tests.c | 35 +++ system/testcodes/adp_v4_cmd_tests/makefile | 250 ++++++++++++++++++ system/testcodes/software_list.txt | 1 + 4 files changed, 354 insertions(+) create mode 100644 system/testcodes/adp_v4_cmd_tests/adp.cmd create mode 100644 system/testcodes/adp_v4_cmd_tests/adp_v4_cmd_tests.c create mode 100644 system/testcodes/adp_v4_cmd_tests/makefile diff --git a/system/testcodes/adp_v4_cmd_tests/adp.cmd b/system/testcodes/adp_v4_cmd_tests/adp.cmd new file mode 100644 index 0000000..dbc0089 --- /dev/null +++ b/system/testcodes/adp_v4_cmd_tests/adp.cmd @@ -0,0 +1,68 @@ +A +a 0x80000000 +a +w byte-0 write test 0xb0 +a +w byte-1 write test 0xb1 +a +w half-1 write test 0xb3b2 +a +w word write test 0xb7b6b5b4 +a +a 0x80000000 +a +r read verify as bytes x 8 0x8 +a +a 0x80000000 +a +r verify as half-words x 4 0x004 +a +a 0x80000000 +a +r verify as words x 2 0x000002 +a +a 0x80000000 +a +r +r +a +u 4 +abcd +a +u 0 +a +u + +! bad command + +a check writes and reads to illegal address space flag '!' faults 0xe0000000 +w 1 +r 1 + +a 0x80000000 + +r 000003 +a 0x80000000 +W +a 0x80000003 +r 0000003 +a 080000003 +r 003 +a 0x80000003 +r 3 + +v 0xdeed +A 90000002 +f 5 +v E5 +f 5 +A 90000000 +R 00000006 + +S STDIN push 0x41 +S STDIN blocked 0x42 +S 0x04 +X +A +B + diff --git a/system/testcodes/adp_v4_cmd_tests/adp_v4_cmd_tests.c b/system/testcodes/adp_v4_cmd_tests/adp_v4_cmd_tests.c new file mode 100644 index 0000000..d985f83 --- /dev/null +++ b/system/testcodes/adp_v4_cmd_tests/adp_v4_cmd_tests.c @@ -0,0 +1,35 @@ +#include "CMSDK_CM0.h" +#include <string.h> +#include "uart_stdout.h" +#include <stdio.h> + +volatile int stdin_irq_occurred; + +int main(void) { + unsigned char ch; + UartStdOutInit(); + printf("ADP dummy test\n"); + while ((ch=UartGetc()) != 0x04) + printf("'%c'\n", ch); + printf("<eot>\n"); + UartEndSimulation(); + return 0; + +} + +/* --------------------------------------------------------------- */ +/* Interrupt handlers */ +/* --------------------------------------------------------------- */ + + +void EXP0_Handler(void) +{ + // AES128 interrupt is caused by Key buffer empty IRQ + stdin_irq_occurred ++; +// AES128->IRQ_MSK_CLR = AES128_KEY_REQ_BIT; + if (stdin_irq_occurred==0) { + puts ("ERROR : Unexpected STDIN interrupt occurred.\n"); + UartEndSimulation(); + while (1); + } +} diff --git a/system/testcodes/adp_v4_cmd_tests/makefile b/system/testcodes/adp_v4_cmd_tests/makefile new file mode 100644 index 0000000..2f1cad0 --- /dev/null +++ b/system/testcodes/adp_v4_cmd_tests/makefile @@ -0,0 +1,250 @@ +#----------------------------------------------------------------------------- +# The confidential and proprietary information contained in this file may +# only be used by a person authorised under and to the extent permitted +# by a subsisting licensing agreement from Arm Limited or its affiliates. +# +# (C) COPYRIGHT 2010-2013 Arm Limited or its affiliates. +# ALL RIGHTS RESERVED +# +# This entire notice must be reproduced on all copies of this file +# and copies of this file may only be made by a person if such person is +# permitted to do so under the terms of a subsisting license agreement +# from Arm Limited or its affiliates. +# +# SVN Information +# +# Checked In : $Date: 2017-10-10 15:55:38 +0100 (Tue, 10 Oct 2017) $ +# +# Revision : $Revision: 371321 $ +# +# Release Information : Cortex-M System Design Kit-r1p1-00rel0 +#----------------------------------------------------------------------------- +# +# Cortex-M System Design Kit software compilation make file +# +#----------------------------------------------------------------------------- +# +# Configurations +# +# Choose the core instantiated, can be +# - CORTEX_M0 +# - CORTEX_M0PLUS +CPU_PRODUCT = CORTEX_M0 + +# Shared software directory +SOFTWARE_DIR = $(SOCLABS_NANOSOC_TECH_DIR)/software +CMSIS_DIR = $(SOFTWARE_DIR)/cmsis +CORE_DIR = $(CMSIS_DIR)/CMSIS/Include + +ifeq ($(CPU_PRODUCT),CORTEX_M0PLUS) + DEVICE_DIR = $(CMSIS_DIR)/Device/ARM/CMSDK_CM0plus +else + DEVICE_DIR = $(CMSIS_DIR)/Device/ARM/CMSDK_CM0 +endif + +# Program file +TESTNAME = adp_v4_cmd_tests + +# Endian Option +COMPILE_BIGEND = 0 + +# Configuration +ifeq ($(CPU_PRODUCT),CORTEX_M0PLUS) + USER_DEFINE = -DCORTEX_M0PLUS +else + USER_DEFINE = -DCORTEX_M0 +endif + +DEPS_LIST = makefile + +# Tool chain : ds5 / gcc / keil +TOOL_CHAIN = ds5 + +ifeq ($(TOOL_CHAIN),ds5) + ifeq ($(CPU_PRODUCT),CORTEX_M0PLUS) + CPU_TYPE = --cpu Cortex-M0plus + else + CPU_TYPE = --cpu Cortex-M0 + endif +endif + +ifeq ($(TOOL_CHAIN),gcc) + ifeq ($(CPU_PRODUCT),CORTEX_M0PLUS) + CPU_TYPE = -mcpu=cortex-m0plus + else + CPU_TYPE = -mcpu=cortex-m0 + endif +endif + +# Startup code directory for DS-5 +ifeq ($(TOOL_CHAIN),ds5) + STARTUP_DIR = $(DEVICE_DIR)/Source/ARM +endif + +# Startup code directory for gcc +ifeq ($(TOOL_CHAIN),gcc) + STARTUP_DIR = $(DEVICE_DIR)/Source/GCC +endif + +ifeq ($(CPU_PRODUCT),CORTEX_M0PLUS) + STARTUP_FILE = startup_CMSDK_CM0plus + SYSTEM_FILE = system_CMSDK_CM0plus +else + STARTUP_FILE = startup_CMSDK_CM0 + SYSTEM_FILE = system_CMSDK_CM0 +endif + +# --------------------------------------------------------------------------------------- +# DS-5 options + +# MicroLIB option +COMPILE_MICROLIB = 0 + +# Small Multiply (Cortex-M0/M0+ has small multiplier option) +COMPILE_SMALLMUL = 0 + +ARM_CC_OPTIONS = -c -O3 -Ospace -I $(DEVICE_DIR)/Include -I $(CORE_DIR) \ + -I $(SOFTWARE_DIR)/common/retarget -I $(SOFTWARE_DIR)/drivers $(USER_DEFINE) +ARM_ASM_OPTIONS = +ARM_LINK_OPTIONS = "--keep=$(STARTUP_FILE).o(RESET)" "--first=$(STARTUP_FILE).o(RESET)" \ + --no_debug --rw_base 0x30000000 --ro_base 0x00000000 --map --info sizes + +ifeq ($(COMPILE_BIGEND),1) + # Big Endian + ARM_CC_OPTIONS += --bigend + ARM_ASM_OPTIONS += --bigend + ARM_LINK_OPTIONS += --be8 +endif + +ifeq ($(COMPILE_MICROLIB),1) + # MicroLIB + ARM_CC_OPTIONS += --library_type=microlib + ARM_ASM_OPTIONS += --library_type=microlib --pd "__MICROLIB SETA 1" + ARM_LINK_OPTIONS += --library_type=microlib +endif + +ifeq ($(COMPILE_SMALLMUL),1) + # In Cortex-M0, small multiply takes 32 cycles + ARM_CC_OPTIONS += --multiply_latency=32 +endif + +# --------------------------------------------------------------------------------------- +# gcc options + +GNG_CC = arm-none-eabi-gcc +GNU_OBJDUMP = arm-none-eabi-objdump +GNU_OBJCOPY = arm-none-eabi-objcopy + +LINKER_SCRIPT_PATH = $(SOFTWARE_DIR)/common/scripts +LINKER_SCRIPT = $(LINKER_SCRIPT_PATH)/cmsdk_cm0.ld + +GNU_CC_FLAGS = -g -O3 -mthumb $(CPU_TYPE) + +ifeq ($(COMPILE_BIGEND),1) + # Big Endian + GNU_CC_FLAGS += -mbig-endian +endif + +# --------------------------------------------------------------------------------------- +all: all_$(TOOL_CHAIN) + +# --------------------------------------------------------------------------------------- +# DS-5 +all_ds5 : $(TESTNAME).hex $(TESTNAME).lst + +$(TESTNAME).o : $(TESTNAME).c $(DEPS_LIST) + armcc $(ARM_CC_OPTIONS) $(CPU_TYPE) $< -o $@ + +$(SYSTEM_FILE).o : $(DEVICE_DIR)/Source/$(SYSTEM_FILE).c $(DEPS_LIST) + armcc $(ARM_CC_OPTIONS) $(CPU_TYPE) $< -o $@ + +retarget.o : $(SOFTWARE_DIR)/common/retarget/retarget.c $(DEPS_LIST) + armcc $(ARM_CC_OPTIONS) $(CPU_TYPE) $< -o $@ + +uart_stdout.o : $(SOFTWARE_DIR)/common/retarget/uart_stdout.c $(DEPS_LIST) + armcc $(ARM_CC_OPTIONS) $(CPU_TYPE) $< -o $@ + +$(STARTUP_FILE).o : $(STARTUP_DIR)/$(STARTUP_FILE).s $(DEPS_LIST) + armasm $(ARM_ASM_OPTIONS) $(CPU_TYPE) $< -o $@ + +$(TESTNAME).ELF : $(TESTNAME).o $(SYSTEM_FILE).o $(STARTUP_FILE).o retarget.o uart_stdout.o + armlink $(ARM_LINK_OPTIONS) -o $@ $(TESTNAME).o $(SYSTEM_FILE).o $(STARTUP_FILE).o retarget.o uart_stdout.o + +$(TESTNAME).hex : $(TESTNAME).ELF + fromelf --vhx --8x1 $< --output $@ + +$(TESTNAME).lst : $(TESTNAME).ELF + fromelf -c -d -e -s -z -v $< --output $@ + +# --------------------------------------------------------------------------------------- +# gcc +all_gcc: + $(GNG_CC) $(GNU_CC_FLAGS) $(STARTUP_DIR)/$(STARTUP_FILE).s \ + $(TESTNAME).c \ + $(SOFTWARE_DIR)/common/retarget/retarget.c \ + $(SOFTWARE_DIR)/common/retarget/uart_stdout.c \ + $(DEVICE_DIR)/Source/$(SYSTEM_FILE).c \ + -I $(DEVICE_DIR)/Include -I $(CORE_DIR) \ + -I $(SOFTWARE_DIR)/common/retarget \ + -I $(SOFTWARE_DIR)/drivers \ + -L $(LINKER_SCRIPT_PATH) \ + -D__STACK_SIZE=0x200 \ + -D__HEAP_SIZE=0x1000 \ + $(USER_DEFINE) -T $(LINKER_SCRIPT) -o $(TESTNAME).o + # Generate disassembly code + $(GNU_OBJDUMP) -S $(TESTNAME).o > $(TESTNAME).lst + # Generate binary file + $(GNU_OBJCOPY) -S $(TESTNAME).o -O binary $(TESTNAME).bin + # Generate hex file + $(GNU_OBJCOPY) -S $(TESTNAME).o -O verilog $(TESTNAME).hex + +# Note: +# If the version of object copy you are using does not support verilog hex file output, +# you can generate the hex file from binary file using the following command +# od -v -A n -t x1 --width=1 $(TESTNAME).bin > $(TESTNAME).hex + + +# --------------------------------------------------------------------------------------- +# Keil MDK + +all_keil: + @echo "Please compile your project code and press ENTER when ready" + @read dummy + +# --------------------------------------------------------------------------------------- +# Binary + +all_bin: $(TESTNAME).bin + # Generate hex file from binary + od -v -A n -t x1 --width=1 $(TESTNAME).bin > $(TESTNAME).hex + +# --------------------------------------------------------------------------------------- +# Clean +clean : + @rm -rf *.o + @if [ -e $(TESTNAME).hex ] ; then \ + rm -rf $(TESTNAME).hex ; \ + fi + @if [ -e $(TESTNAME).lst ] ; then \ + rm -rf $(TESTNAME).lst ; \ + fi + @if [ -e $(TESTNAME).ELF ] ; then \ + rm -rf $(TESTNAME).ELF ; \ + fi + @if [ -e $(TESTNAME).bin ] ; then \ + rm -rf $(TESTNAME).bin ; \ + fi + @rm -rf *.crf + @rm -rf *.plg + @rm -rf *.tra + @rm -rf *.htm + @rm -rf *.map + @rm -rf *.dep + @rm -rf *.d + @rm -rf *.lnp + @rm -rf *.bak + @rm -rf *.lst + @rm -rf *.axf + @rm -rf *.sct + @rm -rf *.__i + @rm -rf *._ia diff --git a/system/testcodes/software_list.txt b/system/testcodes/software_list.txt index e69de29..c61c180 100644 --- a/system/testcodes/software_list.txt +++ b/system/testcodes/software_list.txt @@ -0,0 +1 @@ +adp_v4_cmd_tests -- GitLab