From fc3c55d56da02747bef1efe15a1d69f0c548b22f Mon Sep 17 00:00:00 2001 From: anschrammh Date: Sat, 17 Dec 2022 12:07:44 +0100 Subject: [PATCH] Changed the memory layout to have more flash space allocated to the application, should now have 1.855 MB instead of the 1.152 MB --- .../include/driver/wm_flash_map.h | 2 +- .../include/driver/wm_flash_map_backup.h | 40 ++++ src/W800 SDK v1.00.08/ld/w800/gcc_csky.ld | 9 +- .../ld/w800/gcc_csky_backup.ld | 213 ++++++++++++++++++ src/W800 SDK v1.00.08/tools/w800/.config | 10 +- .../tools/w800/.config_backup | 36 +++ 6 files changed, 303 insertions(+), 7 deletions(-) create mode 100644 src/W800 SDK v1.00.08/include/driver/wm_flash_map_backup.h create mode 100644 src/W800 SDK v1.00.08/ld/w800/gcc_csky_backup.ld create mode 100644 src/W800 SDK v1.00.08/tools/w800/.config_backup diff --git a/src/W800 SDK v1.00.08/include/driver/wm_flash_map.h b/src/W800 SDK v1.00.08/include/driver/wm_flash_map.h index 540077d..de528ca 100644 --- a/src/W800 SDK v1.00.08/include/driver/wm_flash_map.h +++ b/src/W800 SDK v1.00.08/include/driver/wm_flash_map.h @@ -19,7 +19,7 @@ #define CODE_UPD_START_ADDR (0x8010000UL) /**Run-time image header area*/ -#define CODE_RUN_START_ADDR (0x80D0000UL) +#define CODE_RUN_START_ADDR (0x8010000UL) /**Area can be used by User*/ #define USER_ADDR_START (0x81E0000UL) diff --git a/src/W800 SDK v1.00.08/include/driver/wm_flash_map_backup.h b/src/W800 SDK v1.00.08/include/driver/wm_flash_map_backup.h new file mode 100644 index 0000000..540077d --- /dev/null +++ b/src/W800 SDK v1.00.08/include/driver/wm_flash_map_backup.h @@ -0,0 +1,40 @@ +/** + * @file wm_flash_map.h + * + * @brief flash zone map + * + * @author dave + * + * Copyright (c) 2014 Winner Microelectronics Co., Ltd. + */ +#ifndef __WM_FLASH_MAP_H__ +#define __WM_FLASH_MAP_H__ + +/**FLASH MAP**/ + +/**Flash Base Address */ +#define FLASH_BASE_ADDR (0x8000000UL) + +/**Upgrade image area*/ +#define CODE_UPD_START_ADDR (0x8010000UL) + +/**Run-time image header area*/ +#define CODE_RUN_START_ADDR (0x80D0000UL) + +/**Area can be used by User*/ +#define USER_ADDR_START (0x81E0000UL) + + +/**System parameter defined in wm_internal_fls.c*/ +extern unsigned int TLS_FLASH_MESH_PARAM_ADDR; +extern unsigned int TLS_FLASH_PARAM_DEFAULT; +extern unsigned int TLS_FLASH_PARAM1_ADDR; +extern unsigned int TLS_FLASH_PARAM2_ADDR; +extern unsigned int TLS_FLASH_PARAM_RESTORE_ADDR; +extern unsigned int TLS_FLASH_OTA_FLAG_ADDR; +extern unsigned int TLS_FLASH_END_ADDR; + +#define SIGNATURE_WORD (0xA0FFFF9FUL) +#define IMAGE_START_ADDR_MSK (0x400) +#endif /*__WM_CONFIG_H__*/ + diff --git a/src/W800 SDK v1.00.08/ld/w800/gcc_csky.ld b/src/W800 SDK v1.00.08/ld/w800/gcc_csky.ld index ea7193e..4095e0d 100644 --- a/src/W800 SDK v1.00.08/ld/w800/gcc_csky.ld +++ b/src/W800 SDK v1.00.08/ld/w800/gcc_csky.ld @@ -20,9 +20,16 @@ * @version V1.0 * @date 02. June 2017 ******************************************************************************/ + +/****************************************************************************** + * Linker script addresses modified, now the memory map is the following : + * Run Image Header (1KB) starts at 0x0801 0000 + * Application Run Image starts at 0x0801 0400 and is 1,855 MB + * User Area is 112KB and starts at 0x081E 0000 + ******************************************************************************/ MEMORY { - I-SRAM : ORIGIN = 0x080d0400 , LENGTH = 0x120000 /* I-SRAM 1M+128KB */ + I-SRAM : ORIGIN = 0x08010400 , LENGTH = 0x1CFC00 /* I-SRAM 1 855KB */ D-SRAM : ORIGIN = 0x20000100 , LENGTH = 0x47EFC /* D-SRAM 288KB */ V-SRAM : ORIGIN = 0x20000000 , LENGTH = 0x100 /* off-chip SRAM 8MB */ } diff --git a/src/W800 SDK v1.00.08/ld/w800/gcc_csky_backup.ld b/src/W800 SDK v1.00.08/ld/w800/gcc_csky_backup.ld new file mode 100644 index 0000000..ea7193e --- /dev/null +++ b/src/W800 SDK v1.00.08/ld/w800/gcc_csky_backup.ld @@ -0,0 +1,213 @@ +/* + * Copyright (C) 2017 C-SKY Microsystems Co., Ltd. All rights reserved. + * + * Licensed 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. + */ + +/****************************************************************************** + * @file gcc_csky.ld + * @brief csky linker file + * @version V1.0 + * @date 02. June 2017 + ******************************************************************************/ +MEMORY +{ + I-SRAM : ORIGIN = 0x080d0400 , LENGTH = 0x120000 /* I-SRAM 1M+128KB */ + D-SRAM : ORIGIN = 0x20000100 , LENGTH = 0x47EFC /* D-SRAM 288KB */ + V-SRAM : ORIGIN = 0x20000000 , LENGTH = 0x100 /* off-chip SRAM 8MB */ +} + +__min_heap_size = 0x18000; +PROVIDE (__ram_end = 0x2003A000); +PROVIDE (__heap_end = __ram_end); + +REGION_ALIAS("REGION_TEXT", I-SRAM); +REGION_ALIAS("REGION_RODATA", I-SRAM); +REGION_ALIAS("REGION_VDATA", V-SRAM); +REGION_ALIAS("REGION_DATA", D-SRAM); +REGION_ALIAS("REGION_BSS", D-SRAM); + +ENTRY(Reset_Handler) +SECTIONS +{ + .text : { + . = ALIGN(0x4) ; + KEEP(*startup.o(.vectors)) + __stext = . ; + *(.text) + *(.text*) + *(.text.*) + *(.gnu.warning) + *(.stub) + *(.gnu.linkonce.t*) + *(.glue_7t) + *(.glue_7) + *(.jcr) + KEEP (*(.init)) + KEEP (*(.fini)) + . = ALIGN (4) ; + PROVIDE(__ctbp = .); + *(.call_table_data) + *(.call_table_text) + . = ALIGN(0x10) ; + __etext = . ; + } > REGION_TEXT + .rodata : { + . = ALIGN(0x4) ; + __srodata = .; + *(.rdata) + *(.rdata*) + *(.rdata1) + *(.rdata.*) + *(.rodata) + *(.rodata1) + *(.rodata*) + *(.rodata.*) + *(.rodata.str1.4) + . = ALIGN(0x4) ; + __ctor_start__ = .; + KEEP (*crtbegin.o(.ctors)) + KEEP (*crtbegin?.o(.ctors)) + KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + __ctor_end__ = .; + KEEP (*crtbegin.o(.dtors)) + KEEP (*crtbegin?.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + __dtor_end__ = .; + . = ALIGN(0x4) ; + __erodata = .; + } > REGION_RODATA + .vdata : { + . = ALIGN(0x4) ; + __vdata_start__ = . ; + KEEP(*startup.o(.vdata)) + . = ALIGN(0x4) ; + __vdata_end__ = .; + } > REGION_VDATA + .data : { + . = ALIGN(0x4) ; + __sdata = . ; + __data_start__ = . ; + data_start = . ; + *(.got.plt) + *(.got) + *(.gnu.linkonce.r*) + *(.data) + *(.data*) + *(.data1) + *(.data.*) + *(.gnu.linkonce.d*) + *(.data1) + *(.gcc_except_table) + *(.gcc_except_table*) + __start_init_call = .; + *(.initcall.init) + __stop_init_call = .; + __start_cmd = .; + *(.bootloaddata.cmd) + . = ALIGN(4) ; + __stop_cmd = .; + *(.sdata) + *(.sdata.*) + *(.gnu.linkonce.s.*) + *(__libc_atexit) + *(__libc_subinit) + *(__libc_subfreeres) + *(.note.ABI-tag) + . = ALIGN(0x4) ; + __edata = .; + __data_end__ = .; + } > REGION_DATA AT > REGION_RODATA + .bss : { + . = ALIGN(0x4) ; + __sbss = ALIGN(0x4) ; + __bss_start__ = . ; + *(.dynsbss) + *(.sbss) + *(.sbss.*) + *(.scommon) + *(.dynbss) + *(.bss) + *(.bss.*) + *(COMMON) + . = ALIGN(0x4) ; + __ebss = . ; + __end = . ; + end = . ; + __bss_end__ = .; + } > REGION_BSS + ._user_heap : { + . = ALIGN(0x4) ; + __heap_start = .; + . += __min_heap_size; + . = ALIGN(0x4) ; + } > REGION_BSS + .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) } > REGION_BSS + .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) } > REGION_BSS + .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) } + .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) } + .eh_frame_hdr : { *(.eh_frame_hdr) } + .preinit_array : + { + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP (*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + } + .init_array : + { + PROVIDE_HIDDEN (__init_array_start = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + } + .fini_array : + { + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP (*(.fini_array)) + KEEP (*(SORT(.fini_array.*))) + PROVIDE_HIDDEN (__fini_array_end = .); + } + .junk 0 : { *(.rel*) *(.rela*) } + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + .debug_pubtypes 0 : { *(.debug_pubtypes) } + .debug_ranges 0 : { *(.debug_ranges) } + .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) } + /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) } +} diff --git a/src/W800 SDK v1.00.08/tools/w800/.config b/src/W800 SDK v1.00.08/tools/w800/.config index cca15d0..b61db54 100644 --- a/src/W800 SDK v1.00.08/tools/w800/.config +++ b/src/W800 SDK v1.00.08/tools/w800/.config @@ -8,8 +8,8 @@ # CONFIG_W800_TARGET_NAME="w800" CONFIG_W800_IMAGE_TYPE=1 -CONFIG_W800_IMAGE_HEADER=80D0000 -CONFIG_W800_RUN_ADDRESS=80D0400 +CONFIG_W800_IMAGE_HEADER=0x8010000 +CONFIG_W800_RUN_ADDRESS=0x8010400 CONFIG_W800_UPDATE_ADDRESS=8010000 CONFIG_W800_PRIKEY_SEL=0 CONFIG_W800_IMAGE_SIGNATURE=0 @@ -19,7 +19,7 @@ CONFIG_W800_SECBOOT_IMAGE_TYPE=0 # # Download Configuration # -CONFIG_W800_DOWNLOAD_PORT="com18" +CONFIG_W800_DOWNLOAD_PORT="com10" CONFIG_W800_DOWNLOAD_RATE=2000000 # @@ -27,10 +27,10 @@ CONFIG_W800_DOWNLOAD_RATE=2000000 # CONFIG_W800_USE_LIB=y CONFIG_W800_USE_NIMBLE=y -CONFIG_W800_FIRMWARE_DEBUG=y +# CONFIG_W800_FIRMWARE_DEBUG is not set # # Toolchain Configuration # CONFIG_W800_TOOLCHAIN_PREFIX="csky-abiv2-elf" -CONFIG_W800_TOOLCHAIN_PATH="/d/Users/Think/Programmation/Arduino/HLK_W801_KIT_DOC_AND_TOOLS/csky-elfabiv2-tools-mingw-minilibc-20210423/bin/" +CONFIG_W800_TOOLCHAIN_PATH="D:\\csky-elfabiv2-tools-mingw-minilibc-20210423\\bin\\" diff --git a/src/W800 SDK v1.00.08/tools/w800/.config_backup b/src/W800 SDK v1.00.08/tools/w800/.config_backup new file mode 100644 index 0000000..f3bdeec --- /dev/null +++ b/src/W800 SDK v1.00.08/tools/w800/.config_backup @@ -0,0 +1,36 @@ +# +# Automatically generated file; DO NOT EDIT. +# WinnerMicro W800 Configuration +# + +# +# Firmware Configuration +# +CONFIG_W800_TARGET_NAME="w800" +CONFIG_W800_IMAGE_TYPE=1 +CONFIG_W800_IMAGE_HEADER=80D0000 +CONFIG_W800_RUN_ADDRESS=80D0400 +CONFIG_W800_UPDATE_ADDRESS=8010000 +CONFIG_W800_PRIKEY_SEL=0 +CONFIG_W800_IMAGE_SIGNATURE=0 +CONFIG_W800_CODE_ENCRYPT=0 +CONFIG_W800_SECBOOT_IMAGE_TYPE=0 + +# +# Download Configuration +# +CONFIG_W800_DOWNLOAD_PORT="com10" +CONFIG_W800_DOWNLOAD_RATE=2000000 + +# +# Compile Configuration +# +CONFIG_W800_USE_LIB=y +CONFIG_W800_USE_NIMBLE=y +# CONFIG_W800_FIRMWARE_DEBUG is not set + +# +# Toolchain Configuration +# +CONFIG_W800_TOOLCHAIN_PREFIX="csky-abiv2-elf" +CONFIG_W800_TOOLCHAIN_PATH="D:\\csky-elfabiv2-tools-mingw-minilibc-20210423\\bin\\"