Skip to content

Commit f084c38

Browse files
Andrew Boieandrewboie
authored andcommitted
userspace: properly namespace linker vars
App shared memory defines a bunch of symbols in the linker script. Namespace them properly as private zephyr variables. The variables which indicate the bounds of the entire partition now end with "_part_start", "_part_size", and "_part_end" to make them easy for scripts to distinguish them from other generated symbols for data/bss sizes. Finally, the bss size is not rounded up, this was causing unnecessary memory to be zeroed. Signed-off-by: Andrew Boie <[email protected]>
1 parent c8a811b commit f084c38

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

include/app_memory/app_memdomain.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ struct z_app_region {
6262
size_t bss_size;
6363
};
6464

65-
#define Z_APP_START(id) data_smem_##id##_start
66-
#define Z_APP_SIZE(id) data_smem_##id##_size
67-
#define Z_APP_BSS_START(id) data_smem_##id##_bss_start
68-
#define Z_APP_BSS_SIZE(id) data_smem_##id##_bss_size
65+
#define Z_APP_START(id) z_data_smem_##id##_part_start
66+
#define Z_APP_SIZE(id) z_data_smem_##id##_part_size
67+
#define Z_APP_BSS_START(id) z_data_smem_##id##_bss_start
68+
#define Z_APP_BSS_SIZE(id) z_data_smem_##id##_bss_size
6969

7070
/* If a partition is declared with K_APPMEM_PARTITION, but never has any
7171
* data assigned to its contents, then no symbols with its prefix will end

scripts/gen_app_partitions.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
# initialization purpose when USERSPACE is enabled.
2020
data_template = """
2121
/* Auto generated code do not modify */
22-
SMEM_PARTITION_ALIGN(data_smem_{0}_bss_end - data_smem_{0}_start);
23-
data_smem_{0}_start = .;
22+
SMEM_PARTITION_ALIGN(z_data_smem_{0}_bss_end - z_data_smem_{0}_part_start);
23+
z_data_smem_{0}_part_start = .;
2424
KEEP(*(data_smem_{0}_data))
2525
"""
2626

@@ -29,7 +29,7 @@
2929
"""
3030

3131
bss_template = """
32-
data_smem_{0}_bss_start = .;
32+
z_data_smem_{0}_bss_start = .;
3333
KEEP(*(data_smem_{0}_bss))
3434
"""
3535

@@ -38,9 +38,9 @@
3838
"""
3939

4040
footer_template = """
41-
SMEM_PARTITION_ALIGN(data_smem_{0}_bss_end - data_smem_{0}_start);
42-
data_smem_{0}_bss_end = .;
43-
data_smem_{0}_end = .;
41+
z_data_smem_{0}_bss_end = .;
42+
SMEM_PARTITION_ALIGN(z_data_smem_{0}_bss_end - z_data_smem_{0}_part_start);
43+
z_data_smem_{0}_part_end = .;
4444
"""
4545

4646
linker_start_seq = """
@@ -57,8 +57,8 @@
5757
"""
5858

5959
size_cal_string = """
60-
data_smem_{0}_size = data_smem_{0}_end - data_smem_{0}_start;
61-
data_smem_{0}_bss_size = data_smem_{0}_bss_end - data_smem_{0}_bss_start;
60+
z_data_smem_{0}_part_size = z_data_smem_{0}_part_end - z_data_smem_{0}_part_start;
61+
z_data_smem_{0}_bss_size = z_data_smem_{0}_bss_end - z_data_smem_{0}_bss_start;
6262
"""
6363

6464
section_regex = re.compile(r'data_smem_([A-Za-z0-9_]*)_(data|bss)')

0 commit comments

Comments
 (0)