Skip to content

Commit 4657c57

Browse files
committed
Snapshot of current working cli-test
Signed-off-by: Greg Martin <[email protected]>
0 parents  commit 4657c57

File tree

1,812 files changed

+3022491
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,812 files changed

+3022491
-0
lines changed

Diff for: A2_boot/.cproject

+346
Large diffs are not rendered by default.

Diff for: A2_boot/.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.settings/language.settings.xml
2+
/Release/
3+
/Debug/
4+
/verilator/

Diff for: A2_boot/.project

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>A2_boot</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
10+
<triggers>clean,full,incremental,</triggers>
11+
<arguments>
12+
</arguments>
13+
</buildCommand>
14+
<buildCommand>
15+
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
16+
<triggers>full,incremental,</triggers>
17+
<arguments>
18+
</arguments>
19+
</buildCommand>
20+
</buildSpec>
21+
<natures>
22+
<nature>org.eclipse.cdt.core.cnature</nature>
23+
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
24+
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
25+
</natures>
26+
</projectDescription>

Diff for: A2_boot/.settings/org.eclipse.cdt.codan.core.prefs

+109
Large diffs are not rendered by default.

Diff for: A2_boot/.settings/org.eclipse.cdt.core.prefs

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
doxygen/doxygen_new_line_after_brief=true
2+
doxygen/doxygen_use_brief_tag=false
3+
doxygen/doxygen_use_javadoc_tags=true
4+
doxygen/doxygen_use_pre_tag=false
5+
doxygen/doxygen_use_structural_commands=false
6+
eclipse.preferences.version=1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
eclipse.preferences.version=1
2+
environment/buildEnvironmentInclude/ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.debug.1227624879/CPATH/delimiter=\:
3+
environment/buildEnvironmentInclude/ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.debug.1227624879/CPATH/operation=remove
4+
environment/buildEnvironmentInclude/ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.debug.1227624879/C_INCLUDE_PATH/delimiter=\:
5+
environment/buildEnvironmentInclude/ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.debug.1227624879/C_INCLUDE_PATH/operation=remove
6+
environment/buildEnvironmentInclude/ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.debug.1227624879/append=true
7+
environment/buildEnvironmentInclude/ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.debug.1227624879/appendContributed=true
8+
environment/buildEnvironmentInclude/ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.release.104177581/CPATH/delimiter=\:
9+
environment/buildEnvironmentInclude/ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.release.104177581/CPATH/operation=remove
10+
environment/buildEnvironmentInclude/ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.release.104177581/C_INCLUDE_PATH/delimiter=\:
11+
environment/buildEnvironmentInclude/ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.release.104177581/C_INCLUDE_PATH/operation=remove
12+
environment/buildEnvironmentInclude/ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.release.104177581/append=true
13+
environment/buildEnvironmentInclude/ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.release.104177581/appendContributed=true
14+
environment/buildEnvironmentLibrary/ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.debug.1227624879/LIBRARY_PATH/delimiter=\:
15+
environment/buildEnvironmentLibrary/ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.debug.1227624879/LIBRARY_PATH/operation=remove
16+
environment/buildEnvironmentLibrary/ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.debug.1227624879/append=true
17+
environment/buildEnvironmentLibrary/ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.debug.1227624879/appendContributed=true
18+
environment/buildEnvironmentLibrary/ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.release.104177581/LIBRARY_PATH/delimiter=\:
19+
environment/buildEnvironmentLibrary/ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.release.104177581/LIBRARY_PATH/operation=remove
20+
environment/buildEnvironmentLibrary/ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.release.104177581/append=true
21+
environment/buildEnvironmentLibrary/ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.release.104177581/appendContributed=true

Diff for: A2_boot/A2_build.sh

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
if [ $# -eq 0 ]; then
3+
echo "Usage ./A2_build.sh new_workspace"
4+
exit 1
5+
fi
6+
eclipse -nosplash --launcher.suppressErrors -application org.eclipse.cdt.managedbuilder.core.headlessbuild -data ~/$1 -import . -cleanBuild A2_boot/Release
7+
python srec2verilog.py -i Release/A2_boot.srec -o fpga_bootrom.sv

Diff for: A2_boot/compilerPaths.sh

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
export PULP_RISCV_GCC_TOOLCHAIN=/opt/corev-openhw-gcc-ubuntu2004-20200913
3+
export PATH=$PULP_RISCV_GCC_TOOLCHAIN/bin:$PATH
4+
export PATH=/opt/eclipse-embedcpp-2021-03-R-linux-gtk-x86_64/eclipse:$PATH
5+
export PATH=~/bin:$PATH
6+
source /tools/Xilinx/Vivado/2020.2/settings64.sh

Diff for: A2_boot/include/I2CProtocol.h

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#ifndef __I2C_PROTOCOL_H__
2+
#define __I2C_PROTOCOL_H__
3+
4+
typedef struct {
5+
uint16_t SOF;
6+
uint32_t A2RamAddress;
7+
uint8_t CmdType;
8+
uint8_t DataLen;
9+
uint8_t Data[2]; //Indicate start of data.
10+
}__attribute__((packed))I2CProtocolFrame_t;
11+
12+
13+
14+
#define I2C_PROTOCOL_MAX_PAYLOAD_SIZE 240
15+
16+
#define I2C_PROTOCOL_FRAME_HEADER_SIZE (sizeof(I2CProtocolFrame_t) - 2)
17+
#define I2C_PROTOCOL_FRAME_CRC_SIZE 2
18+
#define A2_TO_HOST_FRAME_HEADER 0x5A70
19+
#define HOST_TO_A2_FRAME_HEADER 0xA507
20+
21+
#define A2_I2C_BL_WITHOUT_CRC_IS_READY_CHECK_CMD 0x19
22+
#define A2_I2C_BL_WITH_CRC_IS_READY_CHECK_CMD 0x20
23+
#define A2_I2C_BL_IS_READY_CHECK_RSP_YES 0x21
24+
#define A2_I2C_BL_IS_READY_CHECK_RSP_NO 0x22
25+
#define I2C_NEW_FRAME_READY_BYTE 0x23
26+
#define A2_LOAD_MEMORY_CMD 0x24
27+
#define A2_READ_MEMORY_CMD 0x25
28+
#define A2_JUMP_TO_ADDRESS_CMD 0x26
29+
#define A2_RESET_REASON_POR 0x27
30+
#define A2_RESET_REASON_WDT 0x28
31+
#define A2_RESET_REASON_BUTTON_PRESS 0x29
32+
#define A2_CORRUPTED_FRAME_RCVD 0x30
33+
#define A2_GOOD_FRAME_RCVD 0x31
34+
35+
uint8_t formI2CProtocolFrame(uint8_t *aBuf, uint8_t aBufSize, uint8_t aCmdType, uint8_t *aData, uint8_t aDataLen, uint8_t aCRCOnOff);
36+
void processI2CProtocolFrames(void);
37+
uint8_t sendI2CProtocolFrame(uint8_t *aI2CProtocolFrameBuf, uint8_t aFrameSize);
38+
void parseI2CProtocolFrame(uint8_t *aBuf, uint16_t aLen);
39+
40+
41+
42+
#endif

Diff for: A2_boot/include/bootloader.h

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* bootloader.h
3+
*
4+
* Created on: 21-Jan-2022
5+
* Author: somesh
6+
*/
7+
8+
#ifndef __BOOT_LOADER_H__
9+
#define __BOOT_LOADER_H__
10+
11+
typedef union {
12+
uint32_t w;
13+
uint8_t b[4];
14+
} split_4Byte_t ;
15+
16+
typedef union {
17+
uint16_t hw;
18+
uint8_t b[2];
19+
} split_2Byte_t ;
20+
21+
static inline void __attribute__((noreturn)) jump_to_address(unsigned int address) {
22+
void (*entry)() = (void (*)())((long)address);
23+
entry();
24+
while(1);
25+
}
26+
27+
#endif /* __BOOT_LOADER_H__ */

Diff for: A2_boot/include/crc.h

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
/**********************************************************************
2+
*
3+
* Filename: crc.h
4+
*
5+
* Description: A header file describing the various CRC standards.
6+
*
7+
* Notes:
8+
*
9+
*
10+
* Copyright (c) 2000 by Michael Barr. This software is placed into
11+
* the public domain and may be used for any purpose. However, this
12+
* notice must not be changed or removed and no warranty is either
13+
* expressed or implied by its publication or distribution.
14+
**********************************************************************/
15+
16+
#ifndef _crc_h
17+
#define _crc_h
18+
19+
20+
#define FALSE 0
21+
#define TRUE !FALSE
22+
23+
/*
24+
* Select the CRC standard from the list that follows.
25+
*/
26+
#define CRC_CCITT
27+
28+
29+
#if defined(CRC_CCITT)
30+
31+
typedef unsigned short crc;
32+
33+
#define CRC_NAME "CRC-CCITT"
34+
#define POLYNOMIAL 0x1021
35+
#define INITIAL_REMAINDER 0xFFFF
36+
#define FINAL_XOR_VALUE 0x0000
37+
#define REFLECT_DATA FALSE
38+
#define REFLECT_REMAINDER FALSE
39+
#define CHECK_VALUE 0x29B1
40+
41+
#elif defined(CRC16)
42+
43+
typedef unsigned short crc;
44+
45+
#define CRC_NAME "CRC-16"
46+
#define POLYNOMIAL 0x8005
47+
#define INITIAL_REMAINDER 0x0000
48+
#define FINAL_XOR_VALUE 0x0000
49+
#define REFLECT_DATA TRUE
50+
#define REFLECT_REMAINDER TRUE
51+
#define CHECK_VALUE 0xBB3D
52+
53+
#elif defined(CRC32)
54+
55+
typedef unsigned long crc;
56+
57+
#define CRC_NAME "CRC-32"
58+
#define POLYNOMIAL 0x04C11DB7
59+
#define INITIAL_REMAINDER 0xFFFFFFFF
60+
#define FINAL_XOR_VALUE 0xFFFFFFFF
61+
#define REFLECT_DATA TRUE
62+
#define REFLECT_REMAINDER TRUE
63+
#define CHECK_VALUE 0xCBF43926
64+
65+
#else
66+
67+
#error "One of CRC_CCITT, CRC16, or CRC32 must be #define'd."
68+
69+
#endif
70+
71+
72+
void crcInit(void);
73+
crc crcSlow(unsigned char const message[], int nBytes);
74+
crc crcFast(unsigned char const message[], int nBytes);
75+
76+
77+
#endif /* _crc_h */

Diff for: A2_boot/include/dbg.h

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/* output raw byte, do not map \n -> \r\n */
2+
void dbg_ch_raw(int ch);
3+
4+
/* output a ch, maps \n -> \r\n */
5+
void dbg_ch(int ch);
6+
#define dbg_putc dbg_ch
7+
8+
/* output a \r\n */
9+
void dbg_nl(void);
10+
11+
/* print integer */
12+
void dbg_int(int v);
13+
14+
/* print string, maps \n -> \r\n */
15+
void dbg_str(const char *s);
16+
17+
/* print 8bit value as hex */
18+
void dbg_hex8(uint32_t u32);
19+
20+
/* print 16bit value as hex */
21+
void dbg_hex16(uint32_t u32);
22+
23+
/* print 32bit value as hex */
24+
void dbg_hex32(uint32_t u32);

Diff for: A2_boot/include/flash.h

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
/*
2+
* Copyright (C) 2018 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 __HAL_ROM_ROM_V2_H__
18+
#define __HAL_ROM_ROM_V2_H__
19+
20+
#include <stdint.h>
21+
22+
#define BOOT_STACK_SIZE 1024
23+
#define MAX_NB_AREA 16
24+
#define FLASH_BLOCK_SIZE 4096
25+
26+
27+
28+
typedef struct {
29+
uint32_t start;
30+
uint32_t ptr;
31+
uint32_t size;
32+
uint32_t blocks;
33+
} flash_v2_mem_area_t;
34+
35+
typedef struct {
36+
uint32_t nextDesc;
37+
uint32_t nbAreas;
38+
uint32_t entry;
39+
uint32_t bootaddr;
40+
} flash_v2_header_t;
41+
42+
typedef struct {
43+
uint32_t chipID;
44+
uint32_t nbBinaries;
45+
uint32_t ptrBinaries[6];
46+
} flash_v3_header_t;
47+
48+
typedef struct {
49+
uint32_t checksum;
50+
uint32_t nbAreas;
51+
uint32_t entry;
52+
uint32_t bootaddr;
53+
flash_v2_mem_area_t memArea[16];
54+
} binary_v3_desc_t;
55+
56+
typedef struct {
57+
flash_v2_header_t header;
58+
flash_v2_mem_area_t area;
59+
} flash_v2_header_single_t;
60+
61+
62+
typedef struct {
63+
unsigned char flashBuffer[FLASH_BLOCK_SIZE];
64+
unsigned int udma_buffer[256];
65+
int spi_flash_id;
66+
int step;
67+
flash_v2_header_t header;
68+
flash_v2_mem_area_t memArea[MAX_NB_AREA];
69+
char udma_uart_tx_buffer[1];
70+
unsigned char stack[BOOT_STACK_SIZE];
71+
int hyperflash;
72+
int blockSize;
73+
int qpi;
74+
} boot_code_t;
75+
76+
77+
78+
#define HYPER_FLASH_BLOCK_SIZE_LOG2 10
79+
#define HYPER_FLASH_BLOCK_SIZE (1<<HYPER_FLASH_BLOCK_SIZE_LOG2)
80+
81+
#endif

0 commit comments

Comments
 (0)