Initial Pi Zero support
Both SD card and USB don't work. REPL works over UART. Progress on #5631
This commit is contained in:
parent
8aafc734a4
commit
756b9f6dfa
@ -420,7 +420,10 @@ static sdmmc_err_t cis_tuple_func_manfid(const void* p, uint8_t* data, FILE* fp)
|
||||
int size = *(data++);
|
||||
fprintf(fp, "TUPLE: %s, size: %d\n", tuple->name, size);
|
||||
CIS_CHECK_SIZE(size, 4);
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wcast-align"
|
||||
fprintf(fp, " MANF: %04X, CARD: %04X\n", *(uint16_t*)(data), *(uint16_t*)(data+2));
|
||||
#pragma GCC diagnostic pop
|
||||
return SDMMC_OK;
|
||||
}
|
||||
|
||||
@ -480,7 +483,10 @@ static sdmmc_err_t cis_tuple_func_cftable_entry(const void* p, uint8_t* data, FI
|
||||
CIS_CHECK_SIZE(size, 2);
|
||||
size-=2;
|
||||
CIS_CHECK_UNSUPPORTED(mem_space==1); //other cases not handled yet
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wcast-align"
|
||||
int len = *(uint16_t*)data;
|
||||
#pragma GCC diagnostic pop
|
||||
fprintf(fp, " LEN: %04X\n", len);
|
||||
data+=2;
|
||||
}
|
||||
|
4
main.c
4
main.c
@ -813,8 +813,8 @@ int __attribute__((used)) main(void) {
|
||||
// no SPI flash filesystem, and we might erase the existing one.
|
||||
|
||||
// Check whether CIRCUITPY is available. Don't check if it already hasn't been found.
|
||||
if ((safe_mode != NO_CIRCUITPY) && !filesystem_init(safe_mode == NO_SAFE_MODE, false)) {
|
||||
reset_into_safe_mode(NO_CIRCUITPY);
|
||||
if (!filesystem_init(safe_mode == NO_SAFE_MODE, false)) {
|
||||
safe_mode = NO_CIRCUITPY;
|
||||
}
|
||||
|
||||
// displays init after filesystem, since they could share the flash SPI
|
||||
|
@ -31,7 +31,20 @@ include $(TOP)/supervisor/supervisor.mk
|
||||
# Include make rules and variables common across CircuitPython builds.
|
||||
include $(TOP)/py/circuitpy_defns.mk
|
||||
|
||||
HAL_DIR=hal/$(MCU_SERIES)
|
||||
ifeq ($(CHIP_VARIANT), "bcm2711")
|
||||
CFLAGS += -mcpu=cortex-a72 -DBCM_VERSION=2711
|
||||
CROSS_COMPILE = aarch64-none-elf-
|
||||
SUFFIX = 8
|
||||
else ifeq ($(CHIP_VARIANT), "bcm2837")
|
||||
CFLAGS += -mcpu=cortex-a53 -DBCM_VERSION=2837
|
||||
CROSS_COMPILE = aarch64-none-elf-
|
||||
SUFFIX = 8
|
||||
else ifeq ($(CHIP_VARIANT), "bcm2835")
|
||||
CFLAGS += -mcpu=arm1176jzf-s -DBCM_VERSION=2835
|
||||
CROSS_COMPILE = arm-none-eabi-
|
||||
SUFFIX =
|
||||
# TODO add 32-bit support for Cortex-A7 in 2836
|
||||
endif
|
||||
|
||||
INC += -I. \
|
||||
-I../.. \
|
||||
@ -69,6 +82,7 @@ SRC_C += bindings/videocore/__init__.c \
|
||||
peripherals/broadcom/mmu.c \
|
||||
peripherals/broadcom/vcmailbox.c
|
||||
|
||||
SRC_S = peripherals/broadcom/boot$(SUFFIX).s
|
||||
|
||||
SRC_COMMON_HAL_EXPANDED = $(addprefix shared-bindings/, $(SRC_COMMON_HAL)) \
|
||||
$(addprefix shared-bindings/, $(SRC_BINDINGS_ENUMS)) \
|
||||
@ -82,7 +96,6 @@ SRC_SHARED_MODULE_EXPANDED = $(addprefix shared-bindings/, $(SRC_SHARED_MODULE))
|
||||
# because a few modules have files both in common-hal/ and shared-modules/.
|
||||
# Doing a $(sort ...) removes duplicates as part of sorting.
|
||||
SRC_COMMON_HAL_SHARED_MODULE_EXPANDED = $(sort $(SRC_COMMON_HAL_EXPANDED) $(SRC_SHARED_MODULE_EXPANDED))
|
||||
SRC_S = peripherals/broadcom/boot8.s
|
||||
|
||||
OBJ = $(PY_O) $(SUPERVISOR_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(SRC_COMMON_HAL_SHARED_MODULE_EXPANDED:.c=.o))
|
||||
@ -96,15 +109,6 @@ OBJ += $(addprefix $(BUILD)/, $(SRC_MOD:.c=.o))
|
||||
# BCM CLFAGS
|
||||
CFLAGS += -ffreestanding -nostartfiles -DMICROPY_HW_MCU_NAME="\"$(CHIP_VARIANT)\""
|
||||
|
||||
ifeq ($(CHIP_VARIANT), "bcm2711")
|
||||
CFLAGS += -mcpu=cortex-a72 -DBCM_VERSION=2711
|
||||
CROSS_COMPILE = aarch64-none-elf-
|
||||
else
|
||||
CFLAGS += -mcpu=cortex-a53 -DBCM_VERSION=2837
|
||||
CROSS_COMPILE = aarch64-none-elf-
|
||||
# TODO add 32-bit support for Cortex-A7 and ARM1176
|
||||
endif
|
||||
|
||||
|
||||
OPTIMIZATION_FLAGS ?= -O3
|
||||
CFLAGS += $(OPTIMIZATION_FLAGS)
|
||||
@ -134,32 +138,32 @@ CFLAGS += $(INC) -Wall -Werror -std=gnu11 $(BASE_CFLAGS) $(CFLAGS_MOD) $(COPT) $
|
||||
|
||||
SRC_QSTR += $(SRC_C) $(SRC_SUPERVISOR) $(SRC_COMMON_HAL_EXPANDED) $(SRC_SHARED_MODULE_EXPANDED)
|
||||
|
||||
LDFLAGS += $(CFLAGS) -T peripherals/broadcom/link8.ld -Wl,--gc-sections -Wl,-Map=$@.map # -Wl,--cref
|
||||
LDFLAGS += $(CFLAGS) -T peripherals/broadcom/link$(SUFFIX).ld -Wl,--gc-sections -Wl,-Map=$@.map # -Wl,--cref
|
||||
|
||||
# Use toolchain libm if we're not using our own.
|
||||
ifndef INTERNAL_LIBM
|
||||
LIBS += -lm
|
||||
endif
|
||||
|
||||
all: $(BUILD)/firmware.kernel8.img $(BUILD)/firmware.disk.img.zip
|
||||
all: $(BUILD)/firmware.kernel$(SUFFIX).img $(BUILD)/firmware.disk.img.zip
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
$(BUILD)/kernel8.elf: $(OBJ)
|
||||
$(BUILD)/kernel$(SUFFIX).elf: $(OBJ)
|
||||
$(STEPECHO) "LINK $@"
|
||||
$(Q)echo $(OBJ) > $(BUILD)/firmware.objs
|
||||
$(Q)$(CC) -o $@ $(LDFLAGS) @$(BUILD)/firmware.objs -Wl,--start-group $(LIBS) -Wl,--end-group
|
||||
|
||||
$(BUILD)/kernel8.img: $(BUILD)/kernel8.elf
|
||||
$(BUILD)/kernel$(SUFFIX).img: $(BUILD)/kernel$(SUFFIX).elf
|
||||
$(STEPECHO) "Create $@"
|
||||
$(OBJCOPY) -O binary $(BUILD)/kernel8.elf $@
|
||||
$(OBJCOPY) -O binary $(BUILD)/kernel$(SUFFIX).elf $@
|
||||
|
||||
$(BUILD)/firmware.kernel8.img: $(BUILD)/kernel8.img
|
||||
$(BUILD)/firmware.kernel$(SUFFIX).img: $(BUILD)/kernel$(SUFFIX).img
|
||||
$(STEPECHO) "Create $@"
|
||||
$(CP) $^ $@
|
||||
|
||||
$(BUILD)/firmware.disk.img.zip: $(BUILD)/kernel8.img
|
||||
$(BUILD)/firmware.disk.img.zip: $(BUILD)/kernel$(SUFFIX).img
|
||||
$(STEPECHO) "Create $@"
|
||||
$(Q)dd if=/dev/zero of=$(BUILD)/circuitpython-disk.img bs=1 count=0 seek=256M
|
||||
$(Q)parted -s $(BUILD)/circuitpython-disk.img mktable msdos
|
||||
@ -167,7 +171,7 @@ $(BUILD)/firmware.disk.img.zip: $(BUILD)/kernel8.img
|
||||
$(Q)mkfs.fat -F 32 -n BOOT --offset=2048 $(BUILD)/circuitpython-disk.img
|
||||
|
||||
$(Q)mcopy -i $(BUILD)/circuitpython-disk.img@@1M config.txt firmware/bootcode.bin firmware/fixup* firmware/start* firmware/*.dtb ::
|
||||
$(Q)mcopy -i $(BUILD)/circuitpython-disk.img@@1M $(BUILD)/kernel8.img ::
|
||||
$(Q)mcopy -i $(BUILD)/circuitpython-disk.img@@1M $(BUILD)/kernel$(SUFFIX).img ::
|
||||
$(Q)zip $@ $(BUILD)/circuitpython-disk.img
|
||||
$(Q)rm $(BUILD)/circuitpython-disk.img
|
||||
|
||||
|
56
ports/broadcom/boards/raspberrypi_zero_w/board.c
Normal file
56
ports/broadcom/boards/raspberrypi_zero_w/board.c
Normal file
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2021 Scott Shawcroft for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "supervisor/board.h"
|
||||
#include "mpconfigboard.h"
|
||||
|
||||
#include "bindings/videocore/Framebuffer.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "shared-bindings/framebufferio/FramebufferDisplay.h"
|
||||
|
||||
void board_init(void) {
|
||||
videocore_framebuffer_obj_t *fb = &allocate_display_bus()->videocore;
|
||||
fb->base.type = &videocore_framebuffer_type;
|
||||
common_hal_videocore_framebuffer_construct(fb, 640, 480);
|
||||
|
||||
framebufferio_framebufferdisplay_obj_t *display = &displays[0].framebuffer_display;
|
||||
display->base.type = &framebufferio_framebufferdisplay_type;
|
||||
common_hal_framebufferio_framebufferdisplay_construct(
|
||||
display,
|
||||
MP_OBJ_FROM_PTR(fb),
|
||||
0,
|
||||
true);
|
||||
}
|
||||
|
||||
bool board_requests_safe_mode(void) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void reset_board(void) {
|
||||
}
|
||||
|
||||
void board_deinit(void) {
|
||||
}
|
6
ports/broadcom/boards/raspberrypi_zero_w/mpconfigboard.h
Normal file
6
ports/broadcom/boards/raspberrypi_zero_w/mpconfigboard.h
Normal file
@ -0,0 +1,6 @@
|
||||
#define MICROPY_HW_BOARD_NAME "Raspberry Pi Zero"
|
||||
|
||||
#define DEFAULT_I2C_BUS_SCL (&pin_GPIO3)
|
||||
#define DEFAULT_I2C_BUS_SDA (&pin_GPIO2)
|
||||
|
||||
#define MICROPY_HW_LED_STATUS (&pin_GPIO47)
|
@ -0,0 +1,6 @@
|
||||
USB_VID = 0x2E8A
|
||||
USB_PID = 0xf015
|
||||
USB_PRODUCT = "Raspberry Pi Zero"
|
||||
USB_MANUFACTURER = "Raspberry Pi"
|
||||
|
||||
CHIP_VARIANT = "bcm2835"
|
62
ports/broadcom/boards/raspberrypi_zero_w/pins.c
Normal file
62
ports/broadcom/boards/raspberrypi_zero_w/pins.c
Normal file
@ -0,0 +1,62 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS
|
||||
// These match the names used in Blinka
|
||||
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO0) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO1) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO2) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO2) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO3) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO3) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO4) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO6) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO7) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_CE1), MP_ROM_PTR(&pin_GPIO7) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO8) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_CE0), MP_ROM_PTR(&pin_GPIO8) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO9) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO9) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO10) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO10) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO11) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SCLK), MP_ROM_PTR(&pin_GPIO11) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO11) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO12) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO13) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_GPIO14) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_TXD), MP_ROM_PTR(&pin_GPIO14) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_GPIO15) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_RXD), MP_ROM_PTR(&pin_GPIO15) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO14) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO15) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_GPIO16) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_GPIO17) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_GPIO18) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D19), MP_ROM_PTR(&pin_GPIO19) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_MISO_1), MP_ROM_PTR(&pin_GPIO19) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D20), MP_ROM_PTR(&pin_GPIO20) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_MOSI_1), MP_ROM_PTR(&pin_GPIO20) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D21), MP_ROM_PTR(&pin_GPIO21) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SCLK_1), MP_ROM_PTR(&pin_GPIO21) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SCK_1), MP_ROM_PTR(&pin_GPIO21) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D22), MP_ROM_PTR(&pin_GPIO22) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D23), MP_ROM_PTR(&pin_GPIO23) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D24), MP_ROM_PTR(&pin_GPIO24) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D25), MP_ROM_PTR(&pin_GPIO25) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D26), MP_ROM_PTR(&pin_GPIO26) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D27), MP_ROM_PTR(&pin_GPIO27) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display)},
|
||||
};
|
||||
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);
|
@ -48,9 +48,9 @@ void common_hal_neopixel_write(const digitalio_digitalinout_obj_t *digitalinout,
|
||||
while (port_get_raw_ticks(NULL) < next_start_raw_ticks) {
|
||||
}
|
||||
|
||||
BP_Function_Enum alt_function;
|
||||
BP_Function_Enum alt_function = GPIO_FUNCTION_OUTPUT;
|
||||
uint8_t index;
|
||||
uint8_t channel;
|
||||
uint8_t channel = 0;
|
||||
bool found = false;
|
||||
for (size_t i = 0; i < NUM_ALT_FUNC; i++) {
|
||||
const pin_function_t *f = &digitalinout->pin->functions[i];
|
||||
|
@ -16,7 +16,13 @@ void common_hal_videocore_framebuffer_construct(videocore_framebuffer_obj_t *sel
|
||||
// TODO: Make the FB twice as tall if double buffering.
|
||||
uint32_t physical_height = height;
|
||||
uint32_t pitch = 0;
|
||||
self->framebuffer = vcmailbox_get_framebuffer(&virtual_width, &virtual_height, &physical_width, &physical_height, &pitch);
|
||||
uint32_t bits_per_pixel = 0;
|
||||
self->framebuffer = vcmailbox_get_framebuffer(&virtual_width,
|
||||
&virtual_height,
|
||||
&physical_width,
|
||||
&physical_height,
|
||||
&pitch,
|
||||
&bits_per_pixel);
|
||||
if (self->framebuffer == NULL) {
|
||||
if (gc_alloc_possible()) {
|
||||
mp_raise_ValueError(translate("no fb"));
|
||||
|
@ -36,7 +36,11 @@
|
||||
#define MICROPY_PY_SYS_PLATFORM "BROADCOM"
|
||||
#define MICROPY_PY_BUILTINS_NOTIMPLEMENTED (1)
|
||||
#define MICROPY_PY_FUNCTION_ATTRS (1)
|
||||
#if BCM_VERSION == 2837 || BCM_VERSION == 2711
|
||||
#define MICROPY_OBJ_REPR (MICROPY_OBJ_REPR_A)
|
||||
#elif BCM_VERSION == 2835
|
||||
#define MICROPY_OBJ_REPR (MICROPY_OBJ_REPR_C)
|
||||
#endif
|
||||
#define CIRCUITPY_DEFAULT_STACK_SIZE (0x10000)
|
||||
#define CIRCUITPY_DISPLAY_AREA_BUFFER_SIZE (1920)
|
||||
#define CIRCUITPY_PROCESSOR_COUNT (4)
|
||||
|
@ -41,16 +41,16 @@ mp_uint_t cpu_get_regs_and_sp(mp_uint_t *regs) {
|
||||
__asm__ ("mov %[out], x28" : [out] "=r" (regs[9]));
|
||||
#else
|
||||
__asm__ ("mov %[out], sp" : [out] "=r" (sp));
|
||||
__asm__ ("mov %[out], x19" : [out] "=r" (regs[0]));
|
||||
__asm__ ("mov %[out], x20" : [out] "=r" (regs[1]));
|
||||
__asm__ ("mov %[out], x21" : [out] "=r" (regs[2]));
|
||||
__asm__ ("mov %[out], x22" : [out] "=r" (regs[3]));
|
||||
__asm__ ("mov %[out], x23" : [out] "=r" (regs[4]));
|
||||
__asm__ ("mov %[out], x24" : [out] "=r" (regs[5]));
|
||||
__asm__ ("mov %[out], x25" : [out] "=r" (regs[6]));
|
||||
__asm__ ("mov %[out], x26" : [out] "=r" (regs[7]));
|
||||
__asm__ ("mov %[out], x27" : [out] "=r" (regs[8]));
|
||||
__asm__ ("mov %[out], x28" : [out] "=r" (regs[9]));
|
||||
__asm__ ("mov %[out], r4" : [out] "=r" (regs[0]));
|
||||
__asm__ ("mov %[out], r5" : [out] "=r" (regs[1]));
|
||||
__asm__ ("mov %[out], r6" : [out] "=r" (regs[2]));
|
||||
__asm__ ("mov %[out], r7" : [out] "=r" (regs[3]));
|
||||
__asm__ ("mov %[out], r8" : [out] "=r" (regs[4]));
|
||||
__asm__ ("mov %[out], r9" : [out] "=r" (regs[5]));
|
||||
__asm__ ("mov %[out], r10" : [out] "=r" (regs[6]));
|
||||
__asm__ ("mov %[out], r11" : [out] "=r" (regs[7]));
|
||||
__asm__ ("mov %[out], r12" : [out] "=r" (regs[8]));
|
||||
__asm__ ("mov %[out], r13" : [out] "=r" (regs[9]));
|
||||
#endif
|
||||
|
||||
return sp;
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 2c10889a4b2d78987bc4e0783db2e7584aa4d572
|
||||
Subproject commit 4e1632ab1f15996a9bbe2aa74f92bf138dff691f
|
@ -116,42 +116,57 @@ void reset_to_bootloader(void) {
|
||||
}
|
||||
|
||||
void reset_cpu(void) {
|
||||
|
||||
// Don't actually reset because we can't store the safe mode info.
|
||||
// PM->WDOG = 1 << PM_WDOG_TIME_Pos | PM_WDOG_PASSWD_PASSWD << PM_WDOG_PASSWD_Pos;
|
||||
// PM->RSTC = PM_RSTC_WRCFG_FULL_RESET << PM_RSTC_WRCFG_Pos | PM_RSTC_PASSWD_PASSWD << PM_RSTC_PASSWD_Pos;
|
||||
while (true) {
|
||||
}
|
||||
}
|
||||
|
||||
bool port_has_fixed_stack(void) {
|
||||
#ifdef __aarch64__
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32_t *port_stack_get_limit(void) {
|
||||
return (uint32_t *)0x4;
|
||||
}
|
||||
|
||||
uint32_t *port_stack_get_top(void) {
|
||||
return (uint32_t *)0x80000;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
// From the linker script
|
||||
extern uint32_t __bss_end;
|
||||
extern uint32_t _ld_ram_end;
|
||||
uint32_t *port_stack_get_limit(void) {
|
||||
#ifdef __aarch64__
|
||||
return (uint32_t *)0x4;
|
||||
#else
|
||||
return &__bss_end;
|
||||
#endif
|
||||
}
|
||||
|
||||
uint32_t *port_stack_get_top(void) {
|
||||
#ifdef __aarch64__
|
||||
return (uint32_t *)0x80000;
|
||||
#else
|
||||
return &_ld_ram_end;
|
||||
#endif
|
||||
}
|
||||
|
||||
uint32_t *port_heap_get_bottom(void) {
|
||||
return &__bss_end;
|
||||
}
|
||||
|
||||
uint32_t *port_heap_get_top(void) {
|
||||
// 32M heap
|
||||
return (uint32_t *)(((uint64_t)&__bss_end) + 32 * 1024 * 1024);
|
||||
return (uint32_t *)(((size_t)&__bss_end) + 32 * 1024 * 1024);
|
||||
}
|
||||
|
||||
void port_set_saved_word(uint32_t value) {
|
||||
// NOTE: This doesn't survive pressing the reset button (aka toggling RUN).
|
||||
// watchdog_hw->scratch[0] = value;
|
||||
__bss_end = value;
|
||||
data_clean_and_invalidate(&__bss_end, sizeof(uint32_t));
|
||||
}
|
||||
|
||||
uint32_t port_get_saved_word(void) {
|
||||
// return watchdog_hw->scratch[0];
|
||||
return 0;
|
||||
return __bss_end;
|
||||
}
|
||||
|
||||
uint64_t port_get_raw_ticks(uint8_t *subticks) {
|
||||
|
Loading…
Reference in New Issue
Block a user