Skip to content

Commit

Permalink
Merge commit '16e9b9c44fa62ea6eec99d1fb7bc43a8f1cc2f7e' into from_ups…
Browse files Browse the repository at this point in the history
…tream

Conflicts:
	configure.ac
	tcl/target/gd32vf103.cfg

Change-Id: I72bbb973249b7bbfa720696fa2c76a87a41a2e9c
  • Loading branch information
timsifive committed Dec 22, 2023
2 parents 62758f2 + 16e9b9c commit e4a0658
Show file tree
Hide file tree
Showing 71 changed files with 3,214 additions and 449 deletions.
4 changes: 0 additions & 4 deletions HACKING
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,6 @@ topics. It is possible because @c for/master is not a traditional Git
branch.
-# You will need to install this hook, we will look into a better solution:
@code
scp -p -P 29418 [email protected]:hooks/commit-msg .git/hooks/
@endcode
Or with http only:
@code
wget https://review.openocd.org/tools/hooks/commit-msg
mv commit-msg .git/hooks
chmod +x .git/hooks/commit-msg
Expand Down
6 changes: 3 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ AC_ARG_ENABLE([internal-libjaylink],
[use_internal_libjaylink=$enableval], [use_internal_libjaylink=no])

AC_ARG_ENABLE([remote-bitbang],
AS_HELP_STRING([--enable-remote-bitbang], [Enable building support for the Remote Bitbang jtag driver]),
AS_HELP_STRING([--enable-remote-bitbang], [Enable building support for the Remote Bitbang driver]),
[build_remote_bitbang=$enableval], [build_remote_bitbang=yes])

AS_CASE(["${host_cpu}"],
Expand Down Expand Up @@ -599,9 +599,9 @@ AS_IF([test "x$use_internal_jimtcl" = "xyes"], [

AS_IF([test "x$build_remote_bitbang" = "xyes"], [
build_bitbang=yes
AC_DEFINE([BUILD_REMOTE_BITBANG], [1], [1 if you want the Remote Bitbang JTAG driver.])
AC_DEFINE([BUILD_REMOTE_BITBANG], [1], [1 if you want the Remote Bitbang driver.])
], [
AC_DEFINE([BUILD_REMOTE_BITBANG], [0], [0 if you don't want the Remote Bitbang JTAG driver.])
AC_DEFINE([BUILD_REMOTE_BITBANG], [0], [0 if you don't want the Remote Bitbang driver.])
])

AS_IF([test "x$build_sysfsgpio" = "xyes"], [
Expand Down
1 change: 1 addition & 0 deletions contrib/firmware/angie/c/include/i2c.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ void repeated_start(void);
void stop_cd(void);
void clock_cd(void);
void send_ack(void);
void send_nack(void);
bool get_ack(void);

uint8_t get_address(uint8_t adr, uint8_t rdwr);
Expand Down
10 changes: 10 additions & 0 deletions contrib/firmware/angie/c/src/i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,16 @@ void send_ack(void)
delay_us(1);
}

void send_nack(void)
{
PIN_SDA = 1;
delay_us(1);
PIN_SCL = 1;
delay_us(1);
PIN_SCL = 0;
delay_us(1);
}

bool get_ack(void)
{
PIN_SDA_DIR = 1;
Expand Down
34 changes: 15 additions & 19 deletions contrib/firmware/angie/c/src/usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -757,14 +757,13 @@ void i2c_recieve(void)
PIN_SDA_DIR = 0;
if (EP6FIFOBUF[0] == 1) {
uint8_t rdwr = EP6FIFOBUF[0]; //read
uint8_t reg_adr_check = EP6FIFOBUF[1];
uint8_t count = EP6FIFOBUF[2]; //request data count
uint8_t data_count = EP6FIFOBUF[1]; //data sent count
uint8_t count = EP6FIFOBUF[2]; //requested data count
uint8_t adr = EP6FIFOBUF[3]; //address
uint8_t reg_adr = EP6FIFOBUF[4];
uint8_t address = get_address(adr, rdwr); //address byte (read command)
uint8_t address_2 = get_address(adr, 0); //address byte 2 (write command)

printf("%d\n", address);
printf("%d\n", address - 1);

/* start: */
start_cd();
Expand All @@ -773,41 +772,38 @@ void i2c_recieve(void)
/* ack: */
uint8_t ack = get_ack();

delay_us(10);

/* send data */
if (reg_adr_check) { //if there is a byte reg
send_byte(reg_adr);
/* ack(): */
ack = get_ack();
if (data_count) { //if there is a byte reg
for (uint8_t i = 0; i < data_count; i++) {
send_byte(EP6FIFOBUF[i + 4]);
/* ack(): */
ack = get_ack();
}
}

delay_us(10);

/* repeated start: */
repeated_start();
/* address: */
send_byte(address);
/* get ack: */
ack = get_ack();

delay_us(10);

/* receive data */
for (uint8_t i = 0; i < count; i++) {
for (uint8_t i = 0; i < count - 1; i++) {
EP8FIFOBUF[i] = receive_byte();

/* send ack: */
/* send ack: */
send_ack();
}

delay_ms(1);
EP8FIFOBUF[count - 1] = receive_byte();

/* send Nack: */
send_nack();

/* stop */
stop_cd();

delay_us(10);

EP8BCH = 0; //EP8
syncdelay(3);
EP8BCL = count; //EP8
Expand Down
38 changes: 38 additions & 0 deletions contrib/loaders/trampoline/espressif/xtensa/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# SPDX-License-Identifier: GPL-2.0-or-later

# Espressif Xtensa Makefile to compile flasher stub wrapper
# Copyright (C) 2023 Espressif Systems Ltd.

# Prefix for Espressif xtensa cross compilers (can include a directory path)
CROSS ?= xtensa-esp32-elf-

APP_ARCH := xtensa
APP_CHIP_PATH := $(shell pwd)
SRCS := $(APP_CHIP_PATH)/esp_xtensa_stub_tramp_win.S

BIN2C = ../../../../../src/helper/bin2char.sh
BUILD_DIR = build

APP = esp_xtensa_stub_tramp_win
APP_OBJ = $(BUILD_DIR)/$(APP).o
APP_BIN = $(BUILD_DIR)/$(APP).bin
APP_CODE = $(APP).inc

.PHONY: all clean

all: $(BUILD_DIR) $(APP_OBJ) $(APP_CODE)

$(BUILD_DIR):
$(Q) mkdir $@

$(APP_OBJ): $(SRCS)
@echo " CC $^ -> $@"
$(Q) $(CROSS)gcc -c $(CFLAGS) -o $@ $^

$(APP_CODE): $(APP_OBJ)
@echo " CC $^ -> $@"
$(Q) $(CROSS)objcopy -O binary -j.text $^ $(APP_BIN)
$(Q) $(BIN2C) < $(APP_BIN) > $@

clean:
$(Q) rm -rf $(BUILD_DIR)
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */

/***************************************************************************
* Xtensa flasher stub wrapper *
* Copyright (C) 2017 Espressif Systems Ltd. *
***************************************************************************/

/*
* Expects :
* a0 = zero
* a1 = stack_base + stack_size - 16, 16 bytes aligned
* a8 = address of the function to call
* Params :
* a2 = command arg0, result (out)
* a3 = command arg1
* a4 = command arg2
* a5 = command arg3
* a6 = command arg4
* Maximum 5 user args
*/
.text

.align 4
_stub_enter:
/* initialize initial stack frame for callx8 */
addi a9, sp, 32 /* point 16 past extra save area */
s32e a9, sp, -12 /* access to extra save area */
/* prepare args */
mov a10, a2
mov a11, a3
mov a12, a4
mov a13, a5
mov a14, a6
/* call stub */
callx8 a8
/* prepare return value */
mov a2, a10
break 0,0

_idle_loop:
j _idle_loop
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/* Autogenerated with ../../../../../src/helper/bin2char.sh */
0x92,0xc1,0x20,0x90,0xd1,0x49,0xad,0x02,0xbd,0x03,0xcd,0x04,0xdd,0x05,0x60,0xe6,
0x20,0xe0,0x08,0x00,0x2d,0x0a,0x00,0x40,0x00,0x06,0xff,0xff,
Loading

0 comments on commit e4a0658

Please sign in to comment.