diff --git a/demo/hpm/usb_host/ram.icf b/demo/hpm/usb_host/ram.icf new file mode 100644 index 00000000..78c295c9 --- /dev/null +++ b/demo/hpm/usb_host/ram.icf @@ -0,0 +1,84 @@ +/* + * Copyright 2021 hpmicro + * SPDX-License-Identifier: BSD-3-Clause + */ + + +define memory with size = 4G; + +/* Regions */ +define region CORE0_LM_SLV = [from 0x1000000 size 512k]; /* CORE0 LM slave */ +define region CORE1_LM_SLV = [from 0x1180000 size 512k]; /* CORE1 LM slave */ +define region AXI_SRAM = [from 0x1080000 size 700k]; /* reserve 256K for noncacheable region */ +define region CHERRYUSB_RAM = [from 0x1080000 + 700k size 68k]; /* reserve 256K for noncacheable region */ +define region NONCACHEABLE_RAM = [from 0x1140000 size 256K]; + +define exported symbol __noncacheable_start__ = start of region NONCACHEABLE_RAM; +define exported symbol __noncacheable_end__ = end of region NONCACHEABLE_RAM + 1; +define exported symbol _stack = end of block stack + 1; + +define exported symbol __usbh_class_info_start__ = start of region CHERRYUSB_RAM; +define exported symbol __usbh_class_info_end__ = end of region CHERRYUSB_RAM + 1; + +/* Blocks */ +define block vectors { section .isr_vector, section .vector_table }; +define block ctors { section .ctors, section .ctors.*, block with alphabetical order { init_array } }; +define block dtors { section .dtors, section .dtors.*, block with reverse alphabetical order { fini_array } }; +define block eh_frame { section .eh_frame, section .eh_frame.* }; +define block tbss { section .tbss, section .tbss.* }; +define block tdata { section .tdata, section .tdata.* }; +define block tls { block tbss, block tdata }; +define block tdata_load { copy of block tdata }; +define block heap with size = __HEAPSIZE__, alignment = 8, /* fill =0x00, */ readwrite access { }; +define block stack with size = __STACKSIZE__, alignment = 8, /* fill =0xCD, */ readwrite access { }; +define block framebuffer { section .framebuffer }; +define block safe_stack with size = 512, readwrite access {}; +define exported symbol _stack_safe = end of block safe_stack + 1; + +do not initialize { section .noncacheable }; +do not initialize { section .non_init, section .non_init.*, section .*.non_init, section .*.non_init.* }; +do not initialize { section .no_init, section .no_init.*, section .*.no_init, section .*.no_init.* }; // Legacy sections, kept for backwards compatibility +do not initialize { section .noinit, section .noinit.*, section .*.noinit, section .*.noinit.* }; // Legacy sections, used by some SDKs/HALs + +initialize by copy with packing=auto { section .noncacheable.init }; +initialize by copy with packing=none { section .data, section .data.*, section .*.data, section .*.data.* }; // Static data sections +initialize by copy with packing=auto { section .sdata, section .sdata.* }; +initialize by copy with packing=auto { section .fast, section .fast.*, section .*.fast, section .*.fast.* }; // "RAM Code" sections + +initialize by symbol __SEGGER_init_heap { block heap }; // Init the heap if there is one +initialize by symbol __SEGGER_init_ctors { block ctors }; // Call constructors for global objects which need to be constructed before reaching main (if any). Make sure this is done after setting up heap. + +place at start of CORE0_LM_SLV { symbol _start }; +place in CORE0_LM_SLV { block vectors }; // Vector table section +place in CORE0_LM_SLV with minimum size order { + block tdata_load, // Thread-local-storage load image + block ctors, // Constructors block + block dtors, // Destructors block + block eh_frame, // Exception frames placed directly into flash overriding default placement (sections writable) + readonly, // Catch-all for readonly data (e.g. .rodata, .srodata) + readexec, // Catch-all for (readonly) executable code (e.g. .text) + section .fast, section .fast.*, // "ramfunc" section + }; + +// +// The GNU compiler creates these exception-related sections as writeable. +// Override the section header flag and make them readonly so they can be +// placed into flash. +// +define access readonly { section .gcc_except_table, section .gcc_except_table.* }; +define access readonly { section .eh_frame, section .eh_frame.* }; +define access readonly { section .sdata.DW.* }; + +/* Explicit placement in AXI_SRAM */ +place in AXI_SRAM { block framebuffer }; + +place in AXI_SRAM with auto order { + block tls, // Thread-local-storage block + readwrite, // Catch-all for initialized/uninitialized data sections (e.g. .data, .noinit) + zeroinit, // Catch-all for zero-initialized data sections (e.g. .bss) + }; +place in NONCACHEABLE_RAM { section .noncacheable, section .noncacheable.init, section .noncacheable.bss }; // Noncacheable +place in AXI_SRAM { block heap }; // Heap reserved block +place at end of AXI_SRAM { block stack, block safe_stack }; // Stack reserved block at the end +place in CHERRYUSB_RAM { section .usbh_class_info }; +keep { section .usbh_class_info}; \ No newline at end of file diff --git a/demo/hpm/usb_host/替换 ram.icf 到 hpm_sdk 中.txt b/demo/hpm/usb_host/替换 ram.icf 到 hpm_sdk 中.txt new file mode 100644 index 00000000..e69de29b diff --git a/docs/source/quick_start/other_chip.rst b/docs/source/quick_start/other_chip.rst index 6bf69562..c7433cc9 100644 --- a/docs/source/quick_start/other_chip.rst +++ b/docs/source/quick_start/other_chip.rst @@ -45,6 +45,7 @@ USB Host 移植要点 define exported symbol __usbh_class_info_end__ = end of region CHERRYUSB_RAM + 1; place in CHERRYUSB_RAM { section .usbh_class_info }; + keep { section .usbh_class_info}; - 编译使用。各个 class 如何使用,参考 demo 下的 `usb_host.c` 文件