fix build?
This commit is contained in:
parent
9235698c79
commit
f45e9572e2
4 changed files with 20 additions and 8 deletions
15
Makefile
15
Makefile
|
|
@ -7,7 +7,8 @@ SOC := esp32s3
|
|||
CROSS := riscv32-esp-elf-
|
||||
CC := $(CROSS)gcc
|
||||
STRIP := $(CROSS)strip
|
||||
CFLAGS := -Os -march=rv32imc -mdiv -fdata-sections -ffunction-sections
|
||||
CFLAGS := -g -Os -march=rv32imc -mdiv -fdata-sections -ffunction-sections
|
||||
#CFLAGS += -fvisibility=hidden
|
||||
CFLAGS += -isystem $(IDF_PATH)/components/ulp/ulp_riscv/include/
|
||||
CFLAGS += -isystem $(IDF_PATH)/components/soc/$(SOC)/include
|
||||
CFLAGS += -isystem $(IDF_PATH)/components/esp_common/include
|
||||
|
|
@ -18,11 +19,15 @@ endif
|
|||
ifeq ($(SOC),esp32s2)
|
||||
CFLAGS += -DCONFIG_IDF_TARGET_ESP32S2
|
||||
endif
|
||||
LDFLAGS := -march=rv32imc --specs=nano.specs --specs=nosys.specs
|
||||
ifeq ($(origin USER_CFLAGS),undefined)
|
||||
CFLAGS += $(USER_CFLAGS)
|
||||
endif
|
||||
LDFLAGS := -Wl,-A,elf32-esp32s2ulp -nostdlib --specs=nano.specs --specs=nosys.specs -Wl,--gc-sections
|
||||
|
||||
SRCS ?= ulp.c
|
||||
SRCS += $(IDF_PATH)/components/ulp/ulp_riscv/ulp_riscv_utils.c
|
||||
LDFLAGS += link.ld
|
||||
SRCS += $(IDF_PATH)/components/ulp/ulp_riscv/start.S
|
||||
LDFLAGS += -Wl,-T,link.ld
|
||||
|
||||
|
||||
.PHONY: default
|
||||
|
|
@ -30,8 +35,8 @@ default: a.out-stripped
|
|||
a.out-stripped: a.out
|
||||
$(STRIP) -g -o $@ $<
|
||||
|
||||
a.out: $(SRCS) link.ld
|
||||
$(CC) -flto $(CFLAGS) $^ -o $@ $(LDFLAGS)
|
||||
a.out: $(SRCS) | link.ld Makefile
|
||||
$(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
|
|
|
|||
|
|
@ -11,4 +11,7 @@ en = sy.entry
|
|||
for h in e.iter_headers():
|
||||
if h.p_type == PT_LOAD:
|
||||
print(f"@{h.p_vaddr:04x}: Load {h.p_filesz} bytes starting at {h.p_offset}")
|
||||
content = e._readat(h.p_offset, 16)
|
||||
print(" ".join(f"{b:02x}" for b in content))
|
||||
|
||||
print(f"shared_mem @ 0x{en.st_value:04x} 0x{en.st_size:04x} bytes")
|
||||
|
|
|
|||
8
ulp.c
8
ulp.c
|
|
@ -7,9 +7,13 @@
|
|||
#include "ulp_riscv/ulp_riscv_utils.h"
|
||||
#include "ulp_riscv/ulp_riscv_gpio.h"
|
||||
|
||||
#define EXPORT __attribute__((used,visibility("default")))
|
||||
// global variables will be exported as public symbols, visible from main CPU
|
||||
__attribute__((used)) uint8_t shared_mem[1024];
|
||||
__attribute__((used)) uint16_t shared_mem_len = 1024;
|
||||
EXPORT uint8_t shared_mem[1024];
|
||||
EXPORT uint16_t shared_mem_len = 1024;
|
||||
|
||||
#undef ULP_RISCV_CYCLES_PER_MS
|
||||
#define ULP_RISCV_CYCLES_PER_MS (int)(1000*ULP_RISCV_CYCLES_PER_US)
|
||||
|
||||
int main (void) {
|
||||
shared_mem[0] = 10;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ SECTIONS
|
|||
. = ORIGIN(ram);
|
||||
.text :
|
||||
{
|
||||
*start.S.obj(.text.vectors) /* Default reset vector must link to offset 0x0 */
|
||||
*(.text.vectors) /* Default reset vector must link to offset 0x0 */
|
||||
*(.text)
|
||||
*(.text*)
|
||||
} >ram
|
||||
|
|
|
|||
Loading…
Reference in a new issue