Skip to content

Commit

Permalink
Fix M0S compile
Browse files Browse the repository at this point in the history
  • Loading branch information
harbaum committed Feb 2, 2024
1 parent 7db43bf commit 78fafcb
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 18 deletions.
6 changes: 1 addition & 5 deletions bl616/misterynano_fw/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,11 @@ SDK_DEMO_PATH ?= .
BL_SDK_BASE ?= $(SDK_DEMO_PATH)/../../..

CHIP ?= bl616
BOARD ?= bl616dk
BOARD ?= bl616dk -DCMAKE_C_FLAGS="-DM0S_DOCK=1"
CROSS_COMPILE ?= riscv64-unknown-elf-

include $(BL_SDK_BASE)/project.build

splash.c: splash.png Makefile
convert splash.png -depth 1 GRAY:splash.raw
bin2c -C splash.c splash.raw

term:
term.sh $(COMX) $(BAUDRATE)

Expand Down
20 changes: 12 additions & 8 deletions bl616/misterynano_fw/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,19 @@ struct bflb_device_s *gpio;
#include "menu.h"
#include "sdc.h"

#if __has_include("cfg.h")
#include "cfg.h"
#define ENABLE_FLASHER
#ifndef M0S_DOCK
// building for internal BL616
#warning "Building for internal BL616"
#if __has_include("cfg.h")
#include "cfg.h"
#define ENABLE_FLASHER
#else
#error "-----------------------------------------------------"
#error "No cfg.h found and thus no ft2232d emulator included!"
#error "-----------------------------------------------------"
#endif
#else
#warning "-----------------------------------------------------"
#warning "No cfg.h found and thus no ft2232d emulator included!"
#warning "-----------------------------------------------------"
#define M0S_DOCK
#warning "Building for M0S DOCK"
#endif

#include "sysctrl.h"
Expand Down Expand Up @@ -94,7 +99,6 @@ int main(void) {
gpio = bflb_device_get_by_name("gpio");

#ifdef M0S_DOCK
#warning "M0S DOCK"
// init on-board LEDs
bflb_gpio_init(gpio, GPIO_PIN_27, GPIO_OUTPUT | GPIO_PULLUP | GPIO_SMT_EN | GPIO_DRV_0);
bflb_gpio_init(gpio, GPIO_PIN_28, GPIO_OUTPUT | GPIO_PULLUP | GPIO_SMT_EN | GPIO_DRV_0);
Expand Down
6 changes: 3 additions & 3 deletions bl616/misterynano_fw/sdc.c
Original file line number Diff line number Diff line change
Expand Up @@ -358,9 +358,9 @@ int sdc_image_open(int drive, char *name) {
} else {
printf("file opened, cl=%d(%d)\r\n",
fil[drive].obj.sclust, clst2sect(fil[drive].obj.sclust));
printf("File len = %d, spc = %d, clusters = %d\r\n",
fil[drive].obj.objsize, fs.csize,
fil[drive].obj.objsize / 512 / fs.csize);
printf("File len = %ld, spc = %d, clusters = %d\r\n",
(unsigned long)fil[drive].obj.objsize, fs.csize,
(unsigned long)fil[drive].obj.objsize / 512 / fs.csize);

// try with a 16 entry link table
lktbl[drive] = malloc(16 * sizeof(DWORD));
Expand Down
5 changes: 3 additions & 2 deletions bl616/misterynano_fw/spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ extern struct bflb_device_s *gpio;
#warning "SPI for internal"
#define SPI_PIN_CSN GPIO_PIN_0
#define SPI_PIN_SCK GPIO_PIN_1
#define SPI_PIN_MISO GPIO_PIN_10
// #define SPI_PIN_MISO GPIO_PIN_2
// #define SPI_PIN_MISO GPIO_PIN_2 // filtered on the TN20k
#define SPI_PIN_MISO GPIO_PIN_10 // JTAG TCK replacement
#define SPI_PIN_MOSI GPIO_PIN_3
#define SPI_PIN_IRQ GPIO_PIN_12 // JTAG TDI
#endif

// #define BITBANG
Expand Down

0 comments on commit 78fafcb

Please sign in to comment.