Skip to content

Commit

Permalink
Update SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
Yaooooo committed Mar 1, 2022
1 parent 4ccd08e commit a3a3ae5
Show file tree
Hide file tree
Showing 475 changed files with 65,416 additions and 26,835 deletions.
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,19 @@ openocd.checkout:
fi

openocd.build: openocd.checkout
cd utils/openocd && ./bootstrap && ./configure --enable-jtag_dpi --prefix=$(INSTALL_DIR)/openocd && make && make install
cd utils/openocd && ./bootstrap && ./configure --enable-jtag_dpi --prefix=$(INSTALL_DIR)/openocd && $(MAKE) && $(MAKE) install

openocd.clean:
rm -rf $(INSTALL_DIR)/openocd tools/openocd

PROFILER_V2_DIR = $(GAP_SDK_HOME)/tools/profiler_v2
PROFILER_V2_BUILD_DIR = $(GAP_SDK_HOME)/build/profiler_v2

profiler_v2:
cmake -S $(PROFILER_V2_DIR) -B $(PROFILER_V2_BUILD_DIR)
cmake --build $(PROFILER_V2_BUILD_DIR)
cmake --install $(PROFILER_V2_BUILD_DIR) --prefix $(INSTALL_DIR)

profiler:
$(MAKE) -C tools/profiler all
mkdir -p $(INSTALL_DIR)/bin
Expand Down
3 changes: 2 additions & 1 deletion configs/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ export PYTHONPATH=$GAP_SDK_HOME/gvsoc/gvsoc/engine/python:$PYTHONPATH
export PATH="$GAP_SDK_HOME/utils/gaptest":$PATH

# Audio framework
export PYTHONPATH=$GAP_SDK_HOME/tools/audio-framework/frontends/python_graph_generator:$GAP_SDK_HOME/tools/audio-framework/components:$PYTHONPATH
export GAP_AUDIO_FRAMEWORK_HOME=$GAP_SDK_HOME/tools/audio-framework
export PYTHONPATH=$GAP_AUDIO_FRAMEWORK_HOME/frontends/python_graph_generator:$GAP_AUDIO_FRAMEWORK_HOME/components:$PYTHONPATH


# Autotiler
Expand Down
2 changes: 2 additions & 0 deletions configs/gapuino_v3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ export OPENOCD_CABLE=interface/ftdi/gapuino_ftdi.cfg

export GAPY_TARGET=gapuino_v3

export PLPTEST_DEFAULT_PROPERTIES="chip=gap8_v3 chip_family=gap8 board=gapuino_v3 duration=50 test_duration=50"

source $GAP_SDK_HOME/configs/common.sh
5 changes: 5 additions & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def configure_doxyfile(file_in, file_out, replace_dict):
"../rtos/pmsis/pmsis_api/include/pmsis/rtos/",
"../rtos/pmsis/pmsis_api/include/pmsis/cluster/",
"../rtos/pmsis/pmsis_api/include/pmsis/platforms/",
"../rtos/pmsis/pmsis_api/include/pmsis/",
"../rtos/pmsis/pmsis_bsp/include/",
"source/reference/builtins/headers/",
]
Expand Down Expand Up @@ -86,6 +87,10 @@ def configure_doxyfile(file_in, file_out, replace_dict):
html_theme = "sphinx_rtd_theme"
html_logo = "_static/logo.png"

html_theme_options = {
'navigation_depth' : -1,
}

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
Expand Down
91 changes: 62 additions & 29 deletions examples/autotiler/FFTL1/FFTRunTest.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
#define pmsis_exit(a) exit(a)
#endif

#ifndef SILENT
#define PRINTF printf
#else
#define PRINTF(...) ((void) 0)
#endif

#define __XSTR(__s) __STR(__s)
#define __STR(__s) #__s
#include <stdlib.h>
Expand All @@ -21,7 +27,8 @@
#endif
#define STACK_SIZE 2048
typedef void (*FFTFun_T )(void *Data, void *Twiddles, signed char *shift, unsigned int Nfft, unsigned int Inverse);

PI_L2 int PERF_ARR[6][3][2];
PI_L2 float MSE_ARR[6][2];

short int *InBuff_q16;
float *InBuff_f32, *InBuff_f32R4, *OutBuff_f32;
Expand Down Expand Up @@ -58,14 +65,14 @@ float MSE_f32(float* real, float* calc, int Size){
void CallFFT(int Nfft, int Type){

// FFT: reset buffers, run and check mse
int start, elapsed, elapsedFFT, Q;
int start, elapsed, elapsedFFT, Q = 0;
FFT_InstallArg_T ArgIns;
FFT_Arg_T FFTArg;
AT_L2_EVENT DmaR_Evt1;
void (*FFTFun)(FFT_Arg_T*);
void (*SwapFun)(SwapSamples_Arg_T*);
void (*FFTFun)(FFT_Arg_T*) = 0;
void (*SwapFun)(SwapSamples_Arg_T*) = 0;
char *FFTDataType = 0;
void *InBuff;
void *InBuff = 0;

ArgIns.Nfft = Nfft;
ArgIns.Radix = ((Nfft)==64 || (Nfft)==256 || (Nfft)==1024)?4:2;
Expand Down Expand Up @@ -96,11 +103,11 @@ void CallFFT(int Nfft, int Type){
FFTDataType = "Q16";
switch (Nfft) {
case 64: ArgIns.Twiddles = R4_Twiddles_fix_64; ArgIns.SwapLUT = R4_SwapTable_fix_64; Q = 10; break;
case 128: ArgIns.Twiddles = R2_Twiddles_fix_128; ArgIns.SwapLUT = R2_SwapTable_fix_128; Q = 8; break;
case 256: ArgIns.Twiddles = R4_Twiddles_fix_256; ArgIns.SwapLUT = R4_SwapTable_fix_256; Q = 8; break;
case 512: ArgIns.Twiddles = R2_Twiddles_fix_512; ArgIns.SwapLUT = R2_SwapTable_fix_512; Q = 6; break;
case 1024: ArgIns.Twiddles = R4_Twiddles_fix_1024; ArgIns.SwapLUT = R4_SwapTable_fix_1024; Q = 6; break;
case 2048: ArgIns.Twiddles = R2_Twiddles_fix_2048; ArgIns.SwapLUT = R2_SwapTable_fix_2048; Q = 4; break;
case 128: ArgIns.Twiddles = R2_Twiddles_fix_128; ArgIns.SwapLUT = R2_SwapTable_fix_128; Q = 7; break;
case 256: ArgIns.Twiddles = R4_Twiddles_fix_256; ArgIns.SwapLUT = R4_SwapTable_fix_256; Q = 6; break;
case 512: ArgIns.Twiddles = R2_Twiddles_fix_512; ArgIns.SwapLUT = R2_SwapTable_fix_512; Q = 5; break;
case 1024: ArgIns.Twiddles = R4_Twiddles_fix_1024; ArgIns.SwapLUT = R4_SwapTable_fix_1024; Q = 4; break;
case 2048: ArgIns.Twiddles = R2_Twiddles_fix_2048; ArgIns.SwapLUT = R2_SwapTable_fix_2048; Q = 3; break;
}
if (ArgIns.Radix == 2) FFTFun = &Radix2FFT_DIF_Par_Fix16;
else FFTFun = &Radix4FFT_DIF_Par_Fix16;
Expand Down Expand Up @@ -139,24 +146,32 @@ void CallFFT(int Nfft, int Type){
__CALL((*FFTFun), &FFTArg);
AT_FORK(gap_ncore(), (void *) (*SwapFun), (void *) &SwapArg);
__CALL((*SwapFun), &SwapArg);
elapsed = gap_cl_readhwtimer() - start; printf("| %4d | %3s %6s | %6d | %5d | %6d", Nfft, FFTDataType, ArgIns.Radix==2?"Radix2":"Radix4", elapsedFFT, elapsed, elapsed+elapsedFFT);
elapsed = gap_cl_readhwtimer() - start;

PERF_ARR[Nfft/128][Type][0] = elapsedFFT;
PERF_ARR[Nfft/128][Type][1] = elapsed;


PRINTF("| %4d | %3s %6s | %6d | %5d | %6d", Nfft, FFTDataType, ArgIns.Radix==2?"Radix2":"Radix4", elapsedFFT, elapsed, elapsed+elapsedFFT);
#if !defined(__EMUL__) && defined(PERF_ALL)
printf(" | %7d | %7d | %7d | %8d | %7d |", pi_perf_read(PI_PERF_INSTR), pi_perf_read(PI_PERF_ACTIVE_CYCLES), pi_perf_read(PI_PERF_TCDM_CONT), pi_perf_read(PI_PERF_LD_STALL), pi_perf_read(PI_PERF_IMISS));
PRINTF(" | %7d | %7d | %7d | %8d | %7d |", pi_perf_read(PI_PERF_INSTR), pi_perf_read(PI_PERF_ACTIVE_CYCLES), pi_perf_read(PI_PERF_TCDM_CONT), pi_perf_read(PI_PERF_LD_STALL), pi_perf_read(PI_PERF_IMISS));
#else
printf(" | | | | | |");
PRINTF(" | | | | | |");
#endif
if (Type == 0) {
printf(" |\n");
// printf("\nOutFFT%d_f32 = np.array([\n", Nfft); for(int i=0;i<(Nfft); i++) printf("%f%+fj, ", InBuff_f32[2*i], InBuff_f32[2*i+1]); printf("])\n");
PRINTF(" |\n");
// PRINTF("\nOutFFT%d_f32 = np.array([\n", Nfft); for(int i=0;i<(Nfft); i++) PRINTF("%f%+fj, ", InBuff_f32[2*i], InBuff_f32[2*i+1]); PRINTF("])\n");
} else if (Type == 1) {
// printf("\nOutFFT%d_q16 = np.array([\n", Nfft); for(int i=0;i<(Nfft); i++) printf("%d%+dj, ", ((short int*)InBuff_q16)[2*i], ((short int*)InBuff_q16)[2*i+1]); printf("])\n");
printf(" %f |\n", MSE_16(InBuff_f32, (short int*) InBuff_q16, Nfft, Q));
// PRINTF("\nOutFFT%d_q16 = np.array([\n", Nfft); for(int i=0;i<(Nfft); i++) PRINTF("%d%+dj, ", ((short int*)InBuff_q16)[2*i], ((short int*)InBuff_q16)[2*i+1]); PRINTF("])\n");
MSE_ARR[Nfft/128][0] = MSE_16(InBuff_f32, (short int*) InBuff_q16, Nfft, Q);
PRINTF(" %f |\n", MSE_ARR[Nfft/128][0]);
} else if (Type == 2) {
#ifdef __gap9__
// printf("\nOutFFT%d_f16 = np.array([\n", Nfft); for(int i=0;i<(Nfft); i++) printf("%f%+fj, ", ((f16*)OutBuff)[2*i], ((f16*)OutBuff)[2*i+1]); printf("])\n");
printf(" %f |\n", MSE_f16(InBuff_f32, (f16 *) InBuff_f16, Nfft));
// PRINTF("\nOutFFT%d_f16 = np.array([\n", Nfft); for(int i=0;i<(Nfft); i++) PRINTF("%f%+fj, ", ((f16*)OutBuff)[2*i], ((f16*)OutBuff)[2*i+1]); PRINTF("])\n");
MSE_ARR[Nfft/128][1] = MSE_f16(InBuff_f32, (f16 *) InBuff_f16, Nfft);
PRINTF(" %f |\n", MSE_ARR[Nfft/128][1]);
#else
printf("\n");
PRINTF("\n");
#endif
}
}
Expand All @@ -171,31 +186,31 @@ static void RunFFT()
#endif
gap_cl_resethwtimer();
int start, elapsed, timef32;
printf("Initializing inputs....\n");
PRINTF("Initializing inputs....\n");
//InitData4 (InDataQ16, MAXDIM, 37, 15, 23, 73, 0.1, 0.5, 0.6, 0.8);
//InitData4_float(InDataf32, MAXDIM, 37, 15, 23, 73, 0.1, 0.5, 0.6, 0.8);
#ifdef __gap9__
for (int i=0; i<MAXDIM; i++) InDataf16[i] = (f16) InDataf32[i];
#endif
printf("Done!\n");
PRINTF("Done!\n");

gap_cl_resethwtimer();

int FFTBins = 64;
printf("|----------+------------+--------+-------+--------+---------+---------+---------+----------+---------+----------|\n");
printf("| FFT BINS | Type | FFT | Swap | Tot | Instr | Act Cyc | TCDM Co | LD Stall | Imiss | MSE Err |\n");
printf("|----------+------------+--------+-------+--------+---------+---------+---------+----------+---------+----------|\n");
PRINTF("|----------+------------+--------+-------+--------+---------+---------+---------+----------+---------+----------|\n");
PRINTF("| FFT BINS | Type | FFT | Swap | Tot | Instr | Act Cyc | TCDM Co | LD Stall | Imiss | MSE Err |\n");
PRINTF("|----------+------------+--------+-------+--------+---------+---------+---------+----------+---------+----------|\n");
while (FFTBins < MAXDIM){
//printf("FFT: %4d\n", FFTBins);
//PRINTF("FFT: %4d\n", FFTBins);
CallFFT(FFTBins, 0);
CallFFT(FFTBins, 1);
#ifdef __gap9__
CallFFT(FFTBins, 2);
#endif
FFTBins *= 2;
printf("|----------+------------+--------+-------+--------+---------+---------+---------+----------+---------+----------|\n");
PRINTF("|----------+------------+--------+-------+--------+---------+---------+---------+----------+---------+----------|\n");
}
printf("Finished\n");
PRINTF("Finished\n");
}

void test_kickoff(void *arg)
Expand Down Expand Up @@ -237,7 +252,25 @@ void test_kickoff(void *arg)
task.slave_stack_size = (unsigned int) 1048;
pi_cluster_send_task(&cluster_dev, &task);
#endif
printf("Exiting\n");

int FFTBins = 64;
while (FFTBins < MAXDIM){
if (MSE_ARR[FFTBins/128][0] > 0.016) {
printf("Error: MSE too large for %d FFT Q16\n", FFTBins);
printf("Test FAILED\n");
pmsis_exit(-1);
}
#ifdef __gap9__
if (MSE_ARR[FFTBins/128][1] > 0.000048) {
printf("Error: MSE too large for %d FFT F16\n", FFTBins);
printf("Test FAILED\n");
pmsis_exit(-1);
}
#endif
FFTBins *= 2;
}

printf("Test PASSED\n");
pmsis_exit(0);
}

Expand Down
2 changes: 1 addition & 1 deletion examples/autotiler/FFTL1/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# User Test
#------------------------------------

PMSIS_OS?=pulpos
#PMSIS_OS?=pulpos
APP = test
APP_SRCS += FFTRunTest.c $(AT_HOME)/DSP_Libraries/FFT_Library.c $(AT_HOME)/DSP_Libraries/LUT_Tables/TwiddlesDef.c $(AT_HOME)/DSP_Libraries/LUT_Tables/SwapTablesDef.c
APP_INC +=
Expand Down
7 changes: 2 additions & 5 deletions examples/pmsis/periph/i2c/i2c_scan/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,11 @@ APP_INC +=
APP_CFLAGS +=


runner_args =--trace=corruptor --trace-level=trace
#runner_args =--trace=board.*i2c --trace-level=trace
#runner_args =--trace=board.*i2c:gvsoc.log --trace-level=trace
#runner_args =--trace=eeprom
#runner_args +=--trace-level=trace
ifeq '$(platform)' 'gvsoc'
# Overwrite the default target so that GVSOC simulates our board
# First name is the class name, second one is the python module
export GAPY_PY_TARGET=My_board@my_board
endif

# Append current directory to python path so that it finds our board and module
export PYTHONPATH:=$(CURDIR):$(PYTHONPATH)
Expand Down
15 changes: 9 additions & 6 deletions gvsoc/gvsoc/bin/pulp-pc-info
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,15 @@ toolchain = os.environ.get('PULP_RISCV_GCC_TOOLCHAIN_CI')
if toolchain is None:
toolchain = os.environ.get('PULP_RISCV_GCC_TOOLCHAIN')

if toolchain is not None:
readelf = toolchain + '/bin/riscv32-unknown-elf-readelf'
addr2line = toolchain + '/bin/riscv32-unknown-elf-addr2line'
else:
readelf = 'riscv32-unknown-elf-readelf'
addr2line = 'riscv32-unknown-elf-addr2line'
# if toolchain is not None:
# readelf = toolchain + '/bin/riscv32-unknown-elf-readelf'
# addr2line = toolchain + '/bin/riscv32-unknown-elf-addr2line'
# else:
# readelf = 'riscv32-unknown-elf-readelf'
# addr2line = 'riscv32-unknown-elf-addr2line'

readelf = 'readelf'
addr2line = 'addr2line'

process = Popen((readelf + ' -s %s' % args.file).split(), stdin=PIPE, stdout=PIPE)

Expand Down
Loading

0 comments on commit a3a3ae5

Please sign in to comment.