General cleanup

And multiline commit message test
This commit is contained in:
Polprzewodnikowy 2022-08-20 23:00:41 +02:00
parent 6de29251b5
commit 67d814c7c2
11 changed files with 34 additions and 31 deletions

View File

@ -32,6 +32,7 @@ build_bootloader () {
if [ ! -z "${GIT_BRANCH+x}" ]; then FLAGS+=" -DGIT_BRANCH='\"$GIT_BRANCH\"'"; fi
if [ ! -z "${GIT_TAG+x}" ]; then FLAGS+=" -DGIT_TAG='\"$GIT_TAG\"'"; fi
if [ ! -z "${GIT_SHA+x}" ]; then FLAGS+=" -DGIT_SHA='\"$GIT_SHA\"'"; fi
if [ ! -z "${GIT_MESSAGE+x}" ]; then FLAGS+=" -DGIT_MESSAGE='\"$GIT_MESSAGE\"'"; fi
make all -j USER_FLAGS="$FLAGS"
popd > /dev/null
@ -76,9 +77,10 @@ build_update () {
rm -f ./sc64.upd
fi
GIT_INFO=""
if [ ! -z "${GIT_BRANCH+x}" ]; then GIT_INFO+="branch: $GIT_BRANCH "; fi
if [ ! -z "${GIT_TAG+x}" ]; then GIT_INFO+="tag: $GIT_TAG "; fi
if [ ! -z "${GIT_SHA+x}" ]; then GIT_INFO+="sha: $GIT_SHA "; fi
if [ ! -z "${GIT_BRANCH}" ]; then GIT_INFO+="branch: [$GIT_BRANCH] "; fi
if [ ! -z "${GIT_TAG}" ]; then GIT_INFO+="tag: [$GIT_TAG] "; fi
if [ ! -z "${GIT_SHA}" ]; then GIT_INFO+="sha: [$GIT_SHA] "; fi
if [ ! -z "${GIT_MESSAGE}" ]; then GIT_INFO+="message: [$GIT_MESSAGE] "; fi
GIT_INFO=$(echo "$GIT_INFO" | xargs)
python3 update.py \
--git "$GIT_INFO" \

View File

@ -7,6 +7,7 @@ pushd $(dirname $0) > /dev/null
GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
GIT_TAG=$(git describe --tags 2> /dev/null)
GIT_SHA=$(git rev-parse HEAD)
GIT_MESSAGE=$(git log --oneline --format=%B -n 1 HEAD | head -n 1)
if [ -t 1 ]; then
DOCKER_OPTIONS="-it"
@ -23,6 +24,7 @@ docker run \
-e GIT_BRANCH="$GIT_BRANCH" \
-e GIT_TAG="$GIT_TAG" \
-e GIT_SHA="$GIT_SHA" \
-e GIT_MESSAGE="$GIT_MESSAGE" \
$BUILDER_IMAGE \
./build.sh $@

View File

@ -375,15 +375,10 @@ module mcu_top (
case (address)
REG_STATUS: begin
reg_rdata <= {
24'd0,
sd_det_ff[2],
~fifo_bus.tx_full,
~fifo_bus.rx_empty,
n64_scb.flashram_pending,
29'd0,
n64_scb.cfg_pending,
usb_dma_scb.busy,
usb_scb.reset_pending,
button_ff[2]
~sd_det_ff[2],
~button_ff[2]
};
end

View File

@ -189,7 +189,8 @@ void exception_fatal_handler (uint32_t exception_code, uint32_t interrupt_mask,
exception_print("branch: %s\n", version->git_branch);
exception_print("tag: %s\n", version->git_tag);
exception_print("sha: %s\n\n", version->git_sha);
exception_print("sha: %s\n", version->git_sha);
exception_print("message: %s\n\n", version->git_message);
exception_print("%s\n\n", exception_get_description(exception_code));
exception_print("pc: 0x%08lX sr: 0x%08lX cr: 0x%08lX hw: 0x%08lX [%.4s]\n", e->epc.u32, e->sr, e->cr, sc64_version, (char *) (&sc64_version));
exception_print("zr: 0x%08lX at: 0x%08lX v0: 0x%08lX v1: 0x%08lX\n", e->zr.u32, e->at.u32, e->v0.u32, e->v1.u32);

View File

@ -17,6 +17,11 @@ static version_t version = {
#else
#warning "No GIT_SHA provided"
#endif
#ifdef GIT_MESSAGE
.git_message = GIT_MESSAGE,
#else
#warning "No GIT_MESSAGE provided"
#endif
};

View File

@ -6,6 +6,7 @@ typedef const struct {
const char *git_branch;
const char *git_tag;
const char *git_sha;
const char *git_message;
} version_t;

View File

@ -1,6 +1,5 @@
#!/bin/bash
set -e
case "$1" in

View File

@ -19,10 +19,6 @@ bool button_get_state (void) {
return p.state;
}
button_mode_t button_get_mode (void) {
return p.mode;
}
void button_set_mode (button_mode_t mode) {
p.mode = mode;
if (p.mode == BUTTON_MODE_NONE) {
@ -30,6 +26,10 @@ void button_set_mode (button_mode_t mode) {
}
}
button_mode_t button_get_mode (void) {
return p.mode;
}
void button_init (void) {
p.shift = 0x00000000UL;
p.state = false;
@ -41,7 +41,7 @@ void button_process (void) {
usb_tx_info_t packet_info;
uint32_t status = fpga_reg_get(REG_STATUS);
p.shift <<= 1;
if (!(status & STATUS_BUTTON)) {
if (status & STATUS_BUTTON) {
p.shift |= (1 << 0);
}
if (!p.state && p.shift == 0xFFFFFFFFUL) {

View File

@ -14,8 +14,8 @@ typedef enum {
bool button_get_state (void);
button_mode_t button_get_mode (void);
void button_set_mode (button_mode_t mode);
button_mode_t button_get_mode (void);
void button_init (void);
void button_process (void);

View File

@ -60,22 +60,18 @@ typedef enum {
#define FPGA_MAX_MEM_TRANSFER (1024)
#define USB_STATUS_RXNE (1 << 0)
#define USB_STATUS_TXE (1 << 1)
#define MEM_SCR_START (1 << 0)
#define MEM_SCR_STOP (1 << 1)
#define MEM_SCR_DIRECTION (1 << 2)
#define MEM_SCR_BUSY (1 << 3)
#define MEM_SCR_LENGTH_BIT (4)
#define USB_STATUS_RXNE (1 << 0)
#define USB_STATUS_TXE (1 << 1)
#define STATUS_BUTTON (1 << 0)
#define STATUS_USB_RESET_PENDING (1 << 1)
#define STATUS_DMA_BUSY (1 << 2)
#define STATUS_CFG_PENDING (1 << 3)
#define STATUS_FLASHRAM_PENDING (1 << 4)
#define STATUS_USB_RXNE (1 << 5)
#define STATUS_USB_TXE (1 << 6)
#define STATUS_SD_INSERTED (1 << 1)
#define STATUS_CFG_PENDING (1 << 2)
#define USB_SCR_FIFO_FLUSH (1 << 0)
#define USB_SCR_RXNE (1 << 1)

View File

@ -14,6 +14,7 @@ from io import BufferedRandom
class JedecError(Exception):
pass
class JedecFile:
__fuse_length: int = 0
__fuse_offset: int = 0
@ -175,6 +176,7 @@ class SC64UpdateData:
return self.__data
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='SC64 update file generator')
parser.add_argument('--git', metavar='git', required=False, help='git text to embed in update info')
@ -200,9 +202,9 @@ if __name__ == "__main__":
f'creation time: [{creation_time}]',
]
if (args.git):
info.append(f'git: [{args.git}]')
update_info = '\n'.join(info)
print(f'Update info:\n{update_info}')
info.append(args.git)
update_info = ' '.join(info)
print(update_info)
update.add_update_info(update_info.encode())
if (args.mcu):