This commit is contained in:
pvvx 2016-09-25 10:46:13 +03:00
parent bd27e45421
commit a47f9b574d
5 changed files with 27 additions and 15 deletions

View file

@ -3,7 +3,7 @@ all: ram_all
.PHONY: ram_all .PHONY: ram_all
ram_all: ram_all:
@$(MAKE) -f sdkbuild.mk @$(MAKE) -f sdkbuild.mk
@$(MAKE) -f flasher.mk genbin23 @$(MAKE) -f flasher.mk genbin1 genbin23
.PHONY: clean clean_all .PHONY: clean clean_all
clean: clean:

View file

@ -234,6 +234,10 @@ SECTIONS
/* Check if data + heap + stack exceeds RAM limit */ /* Check if data + heap + stack exceeds RAM limit */
ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
.boot.head :
{
KEEP(*(.loader.head*))
}
} }

View file

@ -55,8 +55,10 @@ FLASHER_SPEED = 500
endif endif
endif endif
#COMPILED_BOOT = 1 # if defined -> extract image1, =1 boot head in elf, =2 boot head ? # COMPILED_BOOT if defined -> extract image1, =1 boot head in elf, =2 boot head ?
PADDINGSIZE = 44k # defined -> image2 OTA #COMPILED_BOOT=1
# PADDINGSIZE defined -> image2 OTA
PADDINGSIZE =44k
NMAPFILE = $(OBJ_DIR)/$(TARGET).nmap NMAPFILE = $(OBJ_DIR)/$(TARGET).nmap
@ -163,28 +165,33 @@ $(OTA_IMAGE): $(RAM2NS_IMAGE) $(RAM3_IMAGE)
$(RAM1P_IMAGE): $(ELFFILE) $(NMAPFILE) $(RAM1P_IMAGE): $(ELFFILE) $(NMAPFILE)
@echo "===========================================================" @echo "==========================================================="
@echo "Create image1p (ram_1.p.bin)" @echo "Create image1p (ram_1.p.bin)"
# @echo "===========================================================" # @echo "===========================================================" .bootloader
ifdef COMPILED_BOOT ifdef COMPILED_BOOT
@mkdir -p $(BIN_DIR) @mkdir -p $(BIN_DIR)
@rm -f $(RAM1_IMAGE) $(RAM1P_IMAGE) @rm -f $(RAM1_IMAGE) $(RAM1P_IMAGE)
@$(eval RAM1_START_ADDR := $(shell grep __ram_image1_text $(NMAPFILE) | grep _start__ | awk '{print $$1}')) ifeq ($(COMPILED_BOOT),1)
@$(eval RAM1_END_ADDR := $(shell grep __ram_image1_text $(NMAPFILE) | grep _end__ | awk '{print $$1}')) @$(eval RAM1_START_ADDR := $(shell grep _binary_build_bin_ram_1_r_bin_start $(NMAPFILE) | awk '{print $$1}'))
@$(eval RAM1_END_ADDR := $(shell grep _binary_build_bin_ram_1_r_bin_end $(NMAPFILE) | awk '{print $$1}'))
else
@$(eval RAM1_START_ADDR := $(shell grep __ram_image1_text_start__ $(NMAPFILE) | awk '{print $$1}'))
@$(eval RAM1_END_ADDR := $(shell grep __ram_image1_text_end__ $(NMAPFILE) | awk '{print $$1}'))
endif
$(if $(RAM1_START_ADDR),,$(error "Not found __ram_image1_text_start__!")) $(if $(RAM1_START_ADDR),,$(error "Not found __ram_image1_text_start__!"))
$(if $(RAM1_END_ADDR),,$(error "Not found __ram_image1_text_end__!")) $(if $(RAM1_END_ADDR),,$(error "Not found __ram_image1_text_end__!"))
ifneq ($(RAM1_START_ADDR),$(RAM1_END_ADDR)) ifeq ($(RAM1_START_ADDR),$(RAM1_END_ADDR))
ifeq ($(COMPILED_BOOT),2) ifneq ($(COMPILED_BOOT),1)
$(OBJCOPY) -j .ram.start.table -j .ram_image1.text -Obinary $(ELFFILE) $(RAM1_IMAGE) $(OBJCOPY) -j .ram.start.table -j .ram_image1.text -Obinary $(ELFFILE) $(RAM1_IMAGE)
$(PICK) 0x$(RAM1_START_ADDR) 0x$(RAM1_END_ADDR) $(RAM1_IMAGE) $(RAM1P_IMAGE) body+reset_offset $(PICK) 0x$(RAM1_START_ADDR) 0x$(RAM1_END_ADDR) $(RAM1_IMAGE) $(RAM1P_IMAGE) body+reset_offset
else else
@$(OBJCOPY) --change-section-address .boot.head=0x10000ba8 -j .boot.head -j .ram.start.table -j .ram_image1.text -Obinary $(ELFFILE) $(RAM1P_IMAGE) $(OBJCOPY) --change-section-address .boot.head=0x10000ba8 -j .boot.head -j .bootloader -Obinary $(ELFFILE) $(RAM1P_IMAGE)
endif
else
@$(error "BOOT-image size = 0")
endif endif
$(warning "Flasher: Use external $(RAM1_IMAGE)?") $(warning "Flasher: Use external $(RAM1_IMAGE)?")
# $(error Flasher: COMPILE_BOOT = No)
else else
@if [ -s $(RAM1P_IMAGE) ]; then echo "Use external $(RAM1P_IMAGE)"; fi $(error "BOOT-image size = 0")
# $(error Flasher: COMPILE_BOOT = No)
endif
else
@if [ -s $(RAM1P_IMAGE) ]; then echo "Use external $(RAM1P_IMAGE)!"; fi
endif endif
$(RAM2P_IMAGE): $(ELFFILE) $(NMAPFILE) $(RAM2P_IMAGE): $(ELFFILE) $(NMAPFILE)

View file

@ -94,9 +94,9 @@ p /x $dumpendaddr
dump binary memory ./build/bin/fullflash.bin $dumpstartaddr $dumpendaddr dump binary memory ./build/bin/fullflash.bin $dumpstartaddr $dumpendaddr
printf "FullFlash saved in ./build/bin/fullflash.bin - OK.\n" printf "FullFlash saved in ./build/bin/fullflash.bin - OK.\n"
#------------------------------------------------------------------ #------------------------------------------------------------------
# Reset
monitor reset
# Boot Flash # Boot Flash
monitor long 0x40000210 = 0x211157 monitor long 0x40000210 = 0x211157
# Reset
monitor reset
monitor go monitor go
quit quit

View file

@ -23,6 +23,7 @@ monitor long 0x40000210 = 0x8011157
# Load the program executable called "image.elf" # Load the program executable called "image.elf"
load build/obj/build.axf load build/obj/build.axf
#continue #continue
monitor reset
monitor go monitor go
quit quit