Files
openharmony_kernel_liteos_m/arch_spec.md
Haryslee d75383400e feat: 支持native动态加载组件
1.【需求描述】
动态库开发部分:
gcc的sample code。
提供生成暴露接口生成机制,并允许产品新增需要暴露的接口。
提供可以判断库允许资源大小的能力,并提供相关工具辅助开发者确定开发的库要求的资源是否可以满足。

动态库运行部分:
提供elf load的api,可以加载指定路径下的库,并完成符号重映射等运行准备。
提供elf 暴露符号调用的api,用于调用库的api。
elf加载&链接异常时,有明确错误记录,返回明确错误类型。
提供elf 卸载的api。

2.【方案描述】
(1) 通过灌段的形式记录需要导出符号的地址信息,用于暴露内核对外的接口,在加载链接器中通过查询
对应的符号信息获取符号地址。
(2) 加载链接时,解析共享库并将共享库中可加载段通过文件系统读入内存中,并对共享库中未定义的、
需要重定位的符号进行重定位。需要调用符号时,根据符号名通过哈希表即可查询共享库提供的对应符号
的地址。

BREAKING CHANGE:
新增4个对外接口,声明在los_dynlink.h文件中,分别为:
(1) LOS_DynlinkInit: 动态加载模块初始化。
(2) LOS_SoLoad: 加载指定路径的共享库。
(3) LOS_FindSym: 根据共享库句柄查找指定符号。
(4) LOS_SoUnload: 卸载共享库。

close #I418HJ

Signed-off-by: Haryslee <lihao189@huawei.com>
Change-Id: I7669b7ef20096294f9d1094c85ac6602fefad354
2021-08-10 20:26:40 +08:00

6.4 KiB

.
├── components                                                  --- Components available for porting and header files exposed externally
│   ├── backtrace                                               --- Backtrace
│   ├── cppsupport                                              --- C++
│   ├── cpup                                                    --- CPUP
│   ├── dynlink                                                 --- Dynamic loader & linker
│   ├── exchook                                                 --- Exception hook
│   ├── fs                                                      --- File System
│   └── net                                                     --- Network
├── kal                                                         --- Kernel Abstraction Layer, APIs exposed externally, including CMSIS APIs and part of POSIX APIs
│   ├── cmsis                                                   --- CMSIS
│   └── posix                                                   --- POSIX
├── kernel                                                      --- Code for defining the minimum kernel function set
│   ├── arch                                                    --- Code of the kernel instruction architecture layer
│   │   ├── arm                                                 --- ARM32 architecture
│   │   │   ├── cortex-m3                                       --- Cortex-m3 architecture
│   │   │   │   └── keil                                        --- Implementation of the Keil toolchain
│   │   │   ├── cortex-m33                                      --- Cortex-m33 architecture
│   │   │   │   │── gcc                                         --- Implementation of the GCC toolchain
│   │   │   │   └── iar                                         --- Implementation of the IAR toolchain
│   │   │   └── cortex-m4                                       --- Cortex-m4 architecture
│   │   │   │   │── gcc                                         --- Implementation of the GCC toolchain
│   │   │   │   └── iar                                         --- Implementation of the IAR toolchain
│   │   │   └── cortex-m7                                       --- Cortex-m7 architecture
│   │   │   │   │── gcc                                         --- Implementation of the GCC toolchain
│   │   │   │   └── iar                                         --- Implementation of the IAR toolchain
│   │   ├── risc-v                                              --- Risc-v architecture
│   │   │   ├── nuclei                                          --- Nuclei architecture
│   │   │   │   └── gcc                                         --- Implementation of the GCC toolchain
│   │   │   └── riscv32                                         --- Riscv32 architecture
│   │   │   │   └── gcc                                         --- Implementation of the GCC toolchain
│   │   └── include
│   │       ├── los_arch.h                                      --- Arch initialization
│   │       ├── los_atomic.h                                    --- Atomic operations
│   │       ├── los_context.h                                   --- Context switch
│   │       ├── los_interrupt.h                                 --- Interrupts
│   │       ├── los_mpu.h                                       --- Memory protection unit operations
│   │       └── los_timer.h                                     --- Timer operations
│   ├── include
│   │   ├── los_config.h                                        --- Configuration parameters
│   │   ├── los_event.h                                         --- Events management
│   │   ├── los_membox.h                                        --- Membox management
│   │   ├── los_memory.h                                        --- Heap memory management
│   │   ├── los_mux.h                                           --- Mutex
│   │   ├── los_queue.h                                         --- Queue
│   │   ├── los_sched.h                                         --- Scheduler
│   │   ├── los_sem.h                                           --- Semaphores
│   │   ├── los_sortlink.h                                      --- Sort link
│   │   ├── los_swtmr.h                                         --- Timer
│   │   ├── los_task.h                                          --- Tasks
│   │   └── los_tick.h                                          --- Tick
│   └── src
├── targets
│   └── targets
│       └── riscv_nuclei_demo_soc_gcc
│       │   ├── GCC                                            --- Compilation config
│       │   ├── OS_CONFIG                                      --- Board config
│       │   ├── SoC                                            --- SOC codes
│       │   └── Src                                            --- Application codes
│       └── riscv_nuclei_gd32vf103_soc_gcc
│       └── riscv_sifive_fe310_gcc
└── utils
    ├── internal
    ├── BUILD.gn                                               --- Gn build config file
    ├── los_compiler.h                                         --- Compiler configuration
    ├── los_debug.c                                            --- Debugging facilities
    ├── los_debug.h
    ├── los_error.c                                            --- Errors codes and definitions
    ├── los_error.h
    ├── los_hook.c                                             --- Hook function facilities
    ├── los_hook.h
    ├── los_list.h                                             --- Doubly linked list
    └── los_reg.h                                              --- Register macros
    └── src