diff --git a/arch/arm/src/.gitignore b/arch/arm/src/.gitignore index ebbb8c670f..2f7ae45cb7 100644 --- a/arch/arm/src/.gitignore +++ b/arch/arm/src/.gitignore @@ -1,3 +1,4 @@ /locked.r /board /chip +/*.S diff --git a/arch/arm/src/Makefile b/arch/arm/src/Makefile index 32ff6ec472..25f7bb44b1 100644 --- a/arch/arm/src/Makefile +++ b/arch/arm/src/Makefile @@ -217,6 +217,9 @@ ifeq ($(BOARDMAKE),y) endif $(call DELFILE, $(KBIN)) $(call DELFILE, $(BIN)) +ifneq ($(EXTRADELFILE),) + $(call DELFILE, $(EXTRADELFILE)) +endif $(call CLEAN) distclean: clean diff --git a/arch/arm/src/rp2040/boot2/Make.defs b/arch/arm/src/rp2040/boot2/Make.defs new file mode 100644 index 0000000000..0ab127fcbc --- /dev/null +++ b/arch/arm/src/rp2040/boot2/Make.defs @@ -0,0 +1,51 @@ +############################################################################ +# arch/arm/src/rp2040/boot2/Make.defs +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. The +# ASF licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the +# License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +############################################################################ + +HEAD_ASRC = $(BOOT_STAGE2).S + +BOOT_STAGE2 = rp2040_boot_stage2 + +CONFIG_RP2040_FLASH_CHIP := $(patsubst "%",%,$(strip $(CONFIG_RP2040_FLASH_CHIP))) + +BOOT2DIR = $(PICO_SDK_PATH)/src/rp2_common/boot_stage2 +BOOT2SRC = $(BOOT2DIR)/boot2_$(CONFIG_RP2040_FLASH_CHIP).S + +BOOT2CFLAGS += -DPICO_BOARD=\"pico\" +BOOT2CFLAGS += -DPICO_BUILD=1 +BOOT2CFLAGS += -DPICO_NO_HARDWARE=0 +BOOT2CFLAGS += -DPICO_ON_DEVICE=1 +BOOT2CFLAGS += -Ichip/boot2 +BOOT2CFLAGS += -I$(BOOT2DIR)/asminclude +BOOT2CFLAGS += -I$(PICO_SDK_PATH)/src/rp2040/hardware_regs/include +BOOT2CFLAGS += -I$(PICO_SDK_PATH)/src/rp2_common/hardware_base/include +BOOT2CFLAGS += -I$(PICO_SDK_PATH)/src/common/pico_base/include +BOOT2CFLAGS += -I$(PICO_SDK_PATH)/src/boards/include +BOOT2CFLAGS += -I$(PICO_SDK_PATH)/src/rp2_common/pico_platform/include + +$(BOOT_STAGE2).S: %.S: %.bin + python3 $(BOOT2DIR)/pad_checksum -s 0xffffffff $< $@ + +$(BOOT_STAGE2).bin: %.bin: %.elf + $(OBJCOPY) -Obinary $< $@ + +$(BOOT_STAGE2).elf: $(BOOT2SRC) + $(CC) $(LDFLAGS) $(BOOT2CFLAGS) -o $@ $< + +EXTRADELFILE = $(BOOT_STAGE2).* diff --git a/arch/arm/src/rp2040/boot2/pico/config.h b/arch/arm/src/rp2040/boot2/pico/config.h new file mode 100644 index 0000000000..371dd18574 --- /dev/null +++ b/arch/arm/src/rp2040/boot2/pico/config.h @@ -0,0 +1 @@ +#include "boards/pico.h"