userspace: remove APP_SHARED_MEM Kconfig
This is an integral part of userspace and cannot be used on its own. Fold into the main userspace configuration. Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
parent
f1920fff46
commit
4ce652e4b2
|
@ -362,9 +362,7 @@ zephyr_cc_option(-Wpointer-arith)
|
|||
# Declare MPU userspace dependencies before the linker scripts to make
|
||||
# sure the order of dependencies are met
|
||||
if(CONFIG_USERSPACE)
|
||||
if(CONFIG_APP_SHARED_MEM)
|
||||
set(APP_SMEM_DEP app_smem_linker)
|
||||
endif()
|
||||
if(CONFIG_ARM)
|
||||
set(PRIV_STACK_DEP priv_stacks_prebuilt)
|
||||
endif()
|
||||
|
@ -1152,7 +1150,7 @@ configure_file(
|
|||
$ENV{ZEPHYR_BASE}/include/arch/arm/cortex_m/scripts/app_smem.ld
|
||||
${PROJECT_BINARY_DIR}/include/generated/app_smem.ld)
|
||||
|
||||
if(CONFIG_APP_SHARED_MEM AND CONFIG_USERSPACE)
|
||||
if(CONFIG_USERSPACE)
|
||||
set(APP_SMEM_LD "${PROJECT_BINARY_DIR}/include/generated/app_smem.ld")
|
||||
set(OBJ_FILE_DIR "${PROJECT_BINARY_DIR}/../")
|
||||
|
||||
|
|
|
@ -446,8 +446,8 @@ void arc_core_mpu_configure_user_context(struct k_thread *thread)
|
|||
|
||||
/* for kernel threads, no need to configure user context */
|
||||
if (!(thread->base.user_options & K_USER)) {
|
||||
#if defined(CONFIG_APP_SHARED_MEM) && CONFIG_ARC_MPU_VER == 3
|
||||
/* APP_SHARED_MEM is handled here, all privileged threads have
|
||||
#if defined(CONFIG_USERSPACE) && CONFIG_ARC_MPU_VER == 3
|
||||
/* USERSPACE is handled here, all privileged threads have
|
||||
* the right to access it.
|
||||
*/
|
||||
base = (u32_t)&_app_smem_start;
|
||||
|
|
|
@ -37,11 +37,11 @@ LOG_MODULE_REGISTER(mpu);
|
|||
/* Convenience macros to denote the start address and the size of the system
|
||||
* memory area, where dynamic memory regions may be programmed at run-time.
|
||||
*/
|
||||
#if defined(CONFIG_APP_SHARED_MEM)
|
||||
#if defined(CONFIG_USERSPACE)
|
||||
#define _MPU_DYNAMIC_REGIONS_AREA_START ((u32_t)&_app_smem_start)
|
||||
#else
|
||||
#define _MPU_DYNAMIC_REGIONS_AREA_START ((u32_t)&__kernel_ram_start)
|
||||
#endif /* CONFIG_APP_SHARED_MEM */
|
||||
#endif /* CONFIG_USERSPACE */
|
||||
#define _MPU_DYNAMIC_REGIONS_AREA_SIZE ((u32_t)&__kernel_ram_end - \
|
||||
_MPU_DYNAMIC_REGIONS_AREA_START)
|
||||
|
||||
|
|
|
@ -314,13 +314,13 @@ __csSet:
|
|||
|
||||
call _x86_data_copy
|
||||
|
||||
#ifdef CONFIG_APP_SHARED_MEM
|
||||
#ifdef CONFIG_USERSPACE
|
||||
movl $_app_smem_start, %edi /* DATA in RAM (dest) */
|
||||
movl $_app_smem_rom_start, %esi /* DATA in ROM (src) */
|
||||
movl $_app_smem_num_words, %ecx /* Size of DATA in quad bytes */
|
||||
|
||||
call _x86_data_copy
|
||||
#endif /* CONFIG_APP_SHARED_MEM */
|
||||
#endif /* CONFIG_USERSPACE */
|
||||
|
||||
#endif /* CONFIG_XIP */
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ MMU_BOOT_REGION((u32_t)&_image_rodata_start, (u32_t)&_image_rodata_size,
|
|||
MMU_ENTRY_READ | MMU_ENTRY_USER |
|
||||
MMU_ENTRY_EXECUTE_DISABLE);
|
||||
|
||||
#ifdef CONFIG_APP_SHARED_MEM
|
||||
#ifdef CONFIG_USERSPACE
|
||||
MMU_BOOT_REGION((u32_t)&_app_smem_start, (u32_t)&_app_smem_size,
|
||||
MMU_ENTRY_WRITE | MMU_ENTRY_RUNTIME_USER |
|
||||
MMU_ENTRY_EXECUTE_DISABLE);
|
||||
|
|
|
@ -265,7 +265,6 @@ Configuration Options
|
|||
Related configuration options:
|
||||
|
||||
* :option:`CONFIG_USERSPACE`
|
||||
* :option:`CONFIG_APP_SHARED_MEM`
|
||||
* :option:`CONFIG_MAX_THREAD_BYTES`
|
||||
|
||||
API Reference
|
||||
|
|
|
@ -33,8 +33,7 @@ the proper alignment for processors requiring power of two boundaries.
|
|||
Without the wrapper, a developer is required to implement custom
|
||||
linker scripts for each processor in the project.
|
||||
|
||||
The general usage is as follows. Define CONFIG_APP_SHARED_MEM=y in the
|
||||
proj.conf file in the project folder. Include app_memory/app_memdomain.h
|
||||
The general usage is as follows. Include app_memory/app_memdomain.h
|
||||
in the userspace source file. Mark the variable to be placed in
|
||||
a memory partition. The two markers are for data and bss respectively:
|
||||
K_APP_DMEM(id) and K_APP_BMEM(id). The id is used as the partition name.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include <misc/dlist.h>
|
||||
#include <kernel.h>
|
||||
|
||||
#ifdef CONFIG_APP_SHARED_MEM
|
||||
#ifdef CONFIG_USERSPACE
|
||||
|
||||
#if defined(CONFIG_X86)
|
||||
#define MEM_DOMAIN_ALIGN_SIZE _STACK_BASE_ALIGN
|
||||
|
@ -104,5 +104,5 @@ struct z_app_region {
|
|||
#define K_APP_BMEM_SECTION(ptn) .bss
|
||||
#define K_APPMEM_PARTITION_DEFINE(name)
|
||||
|
||||
#endif /* CONFIG_APP_SHARED_MEM */
|
||||
#endif /* CONFIG_USERSPACE */
|
||||
#endif /* ZEPHYR_INCLUDE_APP_MEMORY_APP_MEMDOMAIN_H_ */
|
||||
|
|
|
@ -138,7 +138,7 @@ SECTIONS {
|
|||
|
||||
#include <app_data_alignment.ld>
|
||||
|
||||
#if defined(CONFIG_APP_SHARED_MEM)
|
||||
#if defined(CONFIG_USERSPACE)
|
||||
#define APP_SHARED_ALIGN MPU_MIN_SIZE_ALIGN
|
||||
#define SMEM_PARTITION_ALIGN MPU_ALIGN
|
||||
|
||||
|
@ -147,7 +147,7 @@ SECTIONS {
|
|||
_image_ram_start = _app_smem_start;
|
||||
_app_smem_size = _app_smem_end - _app_smem_start;
|
||||
_app_smem_rom_start = LOADADDR(_APP_SMEM_SECTION_NAME);
|
||||
#endif /* CONFIG_APP_SHARED_MEM */
|
||||
#endif /* CONFIG_USERSPACE */
|
||||
|
||||
SECTION_DATA_PROLOGUE(_BSS_SECTION_NAME,(NOLOAD),) {
|
||||
MPU_MIN_SIZE_ALIGN
|
||||
|
|
|
@ -382,7 +382,7 @@ SECTIONS
|
|||
_ramfunc_rom_start = LOADADDR(.ramfunc);
|
||||
#endif /* CONFIG_ARCH_HAS_RAMFUNC_SUPPORT */
|
||||
|
||||
#if defined(CONFIG_APP_SHARED_MEM)
|
||||
#if defined(CONFIG_USERSPACE)
|
||||
#define APP_SHARED_ALIGN . = ALIGN(_region_min_align);
|
||||
#define SMEM_PARTITION_ALIGN MPU_ALIGN
|
||||
|
||||
|
@ -390,7 +390,7 @@ SECTIONS
|
|||
|
||||
_app_smem_size = _app_smem_end - _app_smem_start;
|
||||
_app_smem_rom_start = LOADADDR(_APP_SMEM_SECTION_NAME);
|
||||
#endif /* CONFIG_APP_SHARED_MEM */
|
||||
#endif /* CONFIG_USERSPACE */
|
||||
|
||||
SECTION_DATA_PROLOGUE(_BSS_SECTION_NAME,(NOLOAD),)
|
||||
{
|
||||
|
|
|
@ -207,7 +207,7 @@ SECTIONS
|
|||
__gcov_bss_size = __gcov_bss_end - __gcov_bss_start;
|
||||
#endif /* CONFIG_COVERAGE_GCOV */
|
||||
|
||||
#ifdef CONFIG_APP_SHARED_MEM
|
||||
#ifdef CONFIG_USERSPACE
|
||||
/* APP SHARED MEMORY REGION */
|
||||
#define SMEM_PARTITION_ALIGN(size) MMU_PAGE_ALIGN
|
||||
#define APP_SHARED_ALIGN MMU_PAGE_ALIGN
|
||||
|
@ -219,12 +219,12 @@ SECTIONS
|
|||
_app_smem_num_words = _app_smem_size >> 2;
|
||||
_app_smem_rom_start = LOADADDR(_APP_SMEM_SECTION_NAME);
|
||||
_app_smem_num_words = _app_smem_size >> 2;
|
||||
#endif /* CONFIG_APP_SHARED_MEM */
|
||||
#endif /* CONFIG_USERSPACE */
|
||||
|
||||
SECTION_PROLOGUE(_BSS_SECTION_NAME, (NOLOAD OPTIONAL),)
|
||||
{
|
||||
MMU_PAGE_ALIGN
|
||||
#if !defined(CONFIG_APP_SHARED_MEM)
|
||||
#if !defined(CONFIG_USERSPACE)
|
||||
_image_ram_start = .;
|
||||
#endif
|
||||
/*
|
||||
|
|
|
@ -36,7 +36,7 @@ __syscall size_t _zephyr_fwrite(const void *_MLIBC_RESTRICT ptr, size_t size,
|
|||
size_t nitems, FILE *_MLIBC_RESTRICT stream);
|
||||
#endif /* CONFIG_NEWLIB_LIBC */
|
||||
|
||||
#ifdef CONFIG_APP_SHARED_MEM
|
||||
#ifdef CONFIG_USERSPACE
|
||||
/* Memory partition containing the libc malloc arena */
|
||||
extern struct k_mem_partition z_malloc_partition;
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ void FUNC_NORETURN _StackCheckHandler(void)
|
|||
* Symbol referenced by GCC compiler generated code for canary value.
|
||||
* The canary value gets initialized in _Cstart().
|
||||
*/
|
||||
#ifdef CONFIG_APP_SHARED_MEM
|
||||
#ifdef CONFIG_USERSPACE
|
||||
K_APP_DMEM(z_libc_partition) uintptr_t __stack_chk_guard;
|
||||
#else
|
||||
__noinit uintptr_t __stack_chk_guard;
|
||||
|
|
|
@ -190,7 +190,7 @@ void _data_copy(void)
|
|||
|
||||
data_copy_xip_relocation();
|
||||
#endif /* CONFIG_CODE_DATA_RELOCATION */
|
||||
#ifdef CONFIG_APP_SHARED_MEM
|
||||
#ifdef CONFIG_USERSPACE
|
||||
#ifdef CONFIG_STACK_CANARIES
|
||||
/* stack canary checking is active for all C functions.
|
||||
* __stack_chk_guard is some uninitialized value living in the
|
||||
|
@ -213,7 +213,7 @@ void _data_copy(void)
|
|||
(void)memcpy(&_app_smem_start, &_app_smem_rom_start,
|
||||
((u32_t) &_app_smem_end - (u32_t) &_app_smem_start));
|
||||
#endif /* CONFIG_STACK_CANARIES */
|
||||
#endif /* CONFIG_APP_SHARED_MEM */
|
||||
#endif /* CONFIG_USERSPACE */
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -727,6 +727,29 @@ out:
|
|||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Application memory region initialization
|
||||
*/
|
||||
|
||||
extern char __app_shmem_regions_start[];
|
||||
extern char __app_shmem_regions_end[];
|
||||
|
||||
static int app_shmem_bss_zero(struct device *unused)
|
||||
{
|
||||
struct z_app_region *region, *end;
|
||||
|
||||
end = (struct z_app_region *)&__app_shmem_regions_end;
|
||||
region = (struct z_app_region *)&__app_shmem_regions_start;
|
||||
|
||||
for ( ; region < end; region++) {
|
||||
(void)memset(region->bss_start, 0, region->bss_size);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
SYS_INIT(app_shmem_bss_zero, APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
|
||||
|
||||
/*
|
||||
* Default handlers if otherwise unimplemented
|
||||
*/
|
||||
|
|
|
@ -16,16 +16,16 @@
|
|||
#include <logging/log.h>
|
||||
LOG_MODULE_DECLARE(os);
|
||||
|
||||
#ifdef CONFIG_APP_SHARED_MEM
|
||||
#ifdef CONFIG_USERSPACE
|
||||
K_APPMEM_PARTITION_DEFINE(z_malloc_partition);
|
||||
#endif
|
||||
|
||||
#if (CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE > 0)
|
||||
#ifdef CONFIG_APP_SHARED_MEM
|
||||
#ifdef CONFIG_USERSPACE
|
||||
#define POOL_SECTION K_APP_DMEM_SECTION(z_malloc_partition)
|
||||
#else
|
||||
#define POOL_SECTION .data
|
||||
#endif /* CONFIG_APP_SHARED_MEM */
|
||||
#endif /* CONFIG_USERSPACE */
|
||||
|
||||
K_MUTEX_DEFINE(malloc_mutex);
|
||||
SYS_MEM_POOL_DEFINE(z_malloc_mem_pool, &malloc_mutex, 16,
|
||||
|
|
|
@ -59,7 +59,7 @@ extern void *_heap_sentry;
|
|||
|
||||
static unsigned char *heap_base = UINT_TO_POINTER(USED_RAM_END_ADDR);
|
||||
|
||||
#ifdef CONFIG_APP_SHARED_MEM
|
||||
#ifdef CONFIG_USERSPACE
|
||||
struct k_mem_partition z_malloc_partition;
|
||||
|
||||
static int malloc_prepare(struct device *unused)
|
||||
|
|
|
@ -1,2 +1 @@
|
|||
CONFIG_USERSPACE=y
|
||||
CONFIG_APP_SHARED_MEM=y
|
||||
|
|
|
@ -16,7 +16,7 @@ from elftools.elf.elffile import ELFFile
|
|||
# This script will create sections and linker variables to place the
|
||||
# application shared memory partitions.
|
||||
# these are later read by the macros defined in app_memdomain.h for
|
||||
# initialization purpose when APP_SHARED_MEM is enabled.
|
||||
# initialization purpose when USERSPACE is enabled.
|
||||
data_template = """
|
||||
/* Auto generated code do not modify */
|
||||
SMEM_PARTITION_ALIGN(data_smem_{0}_bss_end - data_smem_{0}_start);
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
add_subdirectory_ifdef(CONFIG_APP_SHARED_MEM app_memory)
|
||||
add_subdirectory(debug)
|
||||
add_subdirectory(logging)
|
||||
add_subdirectory_ifdef(CONFIG_BT bluetooth)
|
||||
|
|
|
@ -37,8 +37,6 @@ source "subsys/settings/Kconfig"
|
|||
|
||||
source "subsys/testsuite/Kconfig"
|
||||
|
||||
source "subsys/app_memory/Kconfig"
|
||||
|
||||
source "subsys/fb/Kconfig"
|
||||
|
||||
source "subsys/jwt/Kconfig"
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
zephyr_library()
|
||||
zephyr_library_sources(app_memdomain.c)
|
|
@ -1,8 +0,0 @@
|
|||
menu "General Kernel Options"
|
||||
|
||||
config APP_SHARED_MEM
|
||||
bool "Application shared memory with app_memory"
|
||||
help
|
||||
This is a wrapper around app_memory to simplify usage.
|
||||
|
||||
endmenu
|
|
@ -1,24 +0,0 @@
|
|||
#include <zephyr.h>
|
||||
#include <init.h>
|
||||
#include <app_memory/app_memdomain.h>
|
||||
#include <string.h>
|
||||
#include <misc/__assert.h>
|
||||
|
||||
extern char __app_shmem_regions_start[];
|
||||
extern char __app_shmem_regions_end[];
|
||||
|
||||
static int app_shmem_bss_zero(struct device *unused)
|
||||
{
|
||||
struct z_app_region *region, *end;
|
||||
|
||||
end = (struct z_app_region *)&__app_shmem_regions_end;
|
||||
region = (struct z_app_region *)&__app_shmem_regions_start;
|
||||
|
||||
for ( ; region < end; region++) {
|
||||
(void)memset(region->bss_start, 0, region->bss_size);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
SYS_INIT(app_shmem_bss_zero, APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
|
|
@ -63,7 +63,6 @@ config TEST_USERSPACE
|
|||
depends on ARCH_HAS_USERSPACE
|
||||
depends on TEST
|
||||
select USERSPACE
|
||||
select APP_SHARED_MEM
|
||||
select DYNAMIC_OBJECTS
|
||||
default y
|
||||
help
|
||||
|
|
|
@ -143,7 +143,7 @@ static inline void unit_test_noop(void)
|
|||
*/
|
||||
|
||||
/* definitions for use with testing application shared memory */
|
||||
#ifdef CONFIG_APP_SHARED_MEM
|
||||
#ifdef CONFIG_USERSPACE
|
||||
#define ZTEST_DMEM K_APP_DMEM(ztest_mem_partition)
|
||||
#define ZTEST_BMEM K_APP_BMEM(ztest_mem_partition)
|
||||
#define ZTEST_SECTION K_APP_DMEM_SECTION(ztest_mem_partition)
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include <ztest.h>
|
||||
#include <stdio.h>
|
||||
#include <app_memory/app_memdomain.h>
|
||||
#ifdef CONFIG_APP_SHARED_MEM
|
||||
#ifdef CONFIG_USERSPACE
|
||||
#include <misc/libc-hooks.h>
|
||||
#endif
|
||||
|
||||
|
@ -282,7 +282,7 @@ void end_report(void)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_APP_SHARED_MEM
|
||||
#ifdef CONFIG_USERSPACE
|
||||
struct k_mem_domain ztest_mem_domain;
|
||||
K_APPMEM_PARTITION_DEFINE(ztest_mem_partition);
|
||||
#endif
|
||||
|
@ -299,7 +299,7 @@ int main(void)
|
|||
#else
|
||||
void main(void)
|
||||
{
|
||||
#ifdef CONFIG_APP_SHARED_MEM
|
||||
#ifdef CONFIG_USERSPACE
|
||||
struct k_mem_partition *parts[] = {
|
||||
&ztest_mem_partition,
|
||||
/* C library globals, stack canary storage, etc */
|
||||
|
@ -314,7 +314,7 @@ void main(void)
|
|||
*/
|
||||
k_mem_domain_init(&ztest_mem_domain, ARRAY_SIZE(parts), parts);
|
||||
k_mem_domain_add_thread(&ztest_mem_domain, k_current_get());
|
||||
#endif /* CONFIG_APP_SHARED_MEM */
|
||||
#endif /* CONFIG_USERSPACE */
|
||||
|
||||
_init_mock();
|
||||
test_main();
|
||||
|
|
|
@ -207,7 +207,7 @@ void test_main(void)
|
|||
{
|
||||
k_thread_access_grant(k_current_get(), &thread_preempt, &stack_preempt,
|
||||
&start_sema, &end_sema);
|
||||
#ifdef CONFIG_APP_SHARED_MEM
|
||||
#ifdef CONFIG_USERSPACE
|
||||
k_mem_domain_add_thread(&ztest_mem_domain, T_KDEFINE_COOP_THREAD);
|
||||
k_mem_domain_add_thread(&ztest_mem_domain, T_KDEFINE_PREEMPT_THREAD);
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue