1 /*
2 * Copyright (c) 2012-2014 Wind River Systems, Inc.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7 #include <zephyr.h>
8 #include <sys/printk.h>
9
10 uint32_t var_sram2_data = 10U;
11 uint32_t var_sram2_bss;
12 K_SEM_DEFINE(test, 0, 1);
13 const uint32_t var_sram2_rodata = 100U;
14
15 __in_section(custom_section, static, var) uint32_t var_custom_data = 1U;
16
17 extern void function_in_sram(int32_t value);
18 void function_in_custom_section(void);
function_in_sram2(void)19 void function_in_sram2(void)
20 {
21 /* Print values from sram2 */
22 printk("Address of function_in_sram2 %p\n", &function_in_sram2);
23 printk("Address of var_sram2_data %p\n", &var_sram2_data);
24 printk("Address of k_sem_give %p\n", &k_sem_give);
25 printk("Address of var_sram2_rodata %p\n", &var_sram2_rodata);
26 printk("Address of var_sram2_bss %p\n\n", &var_sram2_bss);
27
28 /* Print values from sram */
29 function_in_sram(var_sram2_data);
30
31 /* Print values which were placed using attributes */
32 printk("Address of custom_section, func placed using attributes %p\n",
33 &function_in_custom_section);
34 printk("Address of custom_section data placed using attributes %p\n\n",
35 &var_custom_data);
36
37 k_sem_give(&test);
38 }
39
__in_section(custom_section,static,fun)40 __in_section(custom_section, static, fun) void function_in_custom_section(void)
41 {
42 return;
43
44 }
45