Skip to content
Snippets Groups Projects
Unverified Commit 129ef75a authored by CNLohr's avatar CNLohr Committed by GitHub
Browse files

Merge pull request #45 from mengstr/macos

Add support for macOS
parents d71a0500 0aafb44b
No related branches found
No related tags found
No related merge requests found
......@@ -48,6 +48,8 @@ On WSL or Debian based OSes `apt-get install build-essential libnewlib-dev gcc-r
On Windows, download and install (to system) this copy of GCC10. https://gnutoolchains.com/risc-v/
On macOS install the RISC-V toolchain with homebrew following the instructions at https://github.com/riscv-software-src/homebrew-riscv
You can use the pre-compiled minichlink or
## Running
......
......@@ -4822,8 +4822,10 @@ extern "C" {
#define DELAY_US_TIME (SYSTEM_CORE_CLOCK / 8000000)
#define DELAY_MS_TIME (SYSTEM_CORE_CLOCK / 8000)
#if defined(__riscv)
void handle_reset() __attribute__((naked)) __attribute((section(".text.handle_reset"))) __attribute__((used));
void DefaultIRQHandler( void ) __attribute__((section(".text.vector_handler"))) __attribute__((naked)) __attribute__((used));
#endif
void DelaySysTick( uint32_t n );
......
TOOLS:=minichlink
all : $(TOOLS)
CFLAGS:=-O0 -Wall -Wno-asm-operand-widths -Wno-deprecated-declarations -Wno-deprecated-non-prototype -D__MACOSX__
LDFLAGS:=-lpthread -lusb-1.0 -framework CoreFoundation -framework IOKit
INCLUDES=-I /opt/homebrew/Cellar/libusb/1.0.26/include/libusb-1.0
LIBINCLUDES=-L /opt/homebrew/Cellar/libusb/1.0.26/lib
minichlink : minichlink.c pgm-wch-linke.c pgm-esp32s2-ch32xx.c
gcc -o $@ $^ $(LDFLAGS) $(CFLAGS) $(INCLUDES) $(LIBINCLUDES)
inspect_bootloader : minichlink
./minichlink -r test.bin launcher 0x780
riscv64-unknown-elf-objdump -S -D test.bin -b binary -m riscv:rv32 | less
clean :
rm -rf $(TOOLS)
......@@ -8,6 +8,8 @@ On Windows, if you need to you can install the WinUSB driver over the WCH interf
The exe here is about 18kB and contains everything except for the libusb driver. In Linux you need `libusb-1.0-dev`.
On macOS compile using `make -f Makefile.macos`, you need libusb installed which can be done with homebrew `brew install libusb`.
## Usage
```
......
......@@ -720,7 +720,7 @@ static int DefaultWriteWord( void * dev, uint32_t address_to_write, uint32_t dat
iss->currentstateval += 4;
return 0;
return ret;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment