Loading...
Searching...
No Matches
sections.h
1/*
2 * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef _PICO_PLATFORM_SECTION_MACROS_H
8#define _PICO_PLATFORM_SECTION_MACROS_H
9
10#ifndef __ASSEMBLER__
11
24#ifndef __after_data
25#define __after_data(group) __attribute__((section(".after_data." group)))
26#endif
27
41#ifndef __in_ram
42#define __in_ram(group) __attribute__((section(".time_critical." group)))
43#endif
44
60#ifndef __in_scratch_x
61#define __in_scratch_x(group) __attribute__((section(".scratch_x." group)))
62#endif
63
72#ifndef __scratch_x
73#define __scratch_x(group) __in_scratch_x(group)
74#endif
75
91#ifndef __in_scratch_y
92#define __in_scratch_y(group) __attribute__((section(".scratch_y." group)))
93#endif
94
103#ifndef __scratch_y
104#define __scratch_y(group) __in_scratch_y(group)
105#endif
106
126#ifndef __in_psram
127#define __in_psram(group) __attribute__((section(".psram_initialised." group)))
128#endif
129
138#ifndef __uninitialized_psram
139#define __uninitialized_psram(group) __attribute__((section(".psram_uninitialised." group)))
140#endif
141
157#ifndef __in_xip_ram
158#if PICO_USE_XIP_CACHE_AS_RAM || PICO_COMBINED_DOCS
159#define __in_xip_ram(group) __attribute__((section(".xip_ram." group)))
160#elif PICO_XIP_RAM
161#define __in_xip_ram(group) __in_ram(group)
162#else
163#define __in_xip_ram(group) x; static_assert(false, "Must set PICO_USE_XIP_CACHE_AS_RAM=1 to use the __in_xip_ram macro");
164#endif
165#endif
166
182#ifndef __uninitialized_ram
183#define __uninitialized_ram(group) __attribute__((section(".uninitialized_data." #group))) group
184#endif
185
201#if (LIB_PICO_LOW_POWER && HAS_POWMAN_TIMER) || PICO_COMBINED_DOCS
202#ifndef __persistent_data
203#define __persistent_data(name) __attribute__((section(".persistent_data." #name))) name
204#endif
205#else
206// If not supported, use the .bss section, as that will be zeroed on boot
207#ifndef __persistent_data
208#define __persistent_data(name) __attribute__((section(".bss." #name))) name
209#endif
210#endif
211
224#ifndef __in_flash
225#define __in_flash(group) __attribute__((section(".flashdata." group)))
226#endif
227
228// Above the doxygen, to avoid confusing it
229#ifndef PICO_NOT_IN_FLASH_PLACEMENT
230#define PICO_NOT_IN_FLASH_PLACEMENT __in_ram
231#endif
249#ifndef __not_in_flash
250#define __not_in_flash(group) PICO_NOT_IN_FLASH_PLACEMENT(group)
251#endif
252
272#ifndef __not_in_flash_func
273#define __not_in_flash_func(func_name) __not_in_flash(__STRING(func_name)) func_name
274#endif
275
282#ifndef __no_inline_not_in_flash_func
283#define __no_inline_not_in_flash_func(func_name) __noinline __not_in_flash_func(func_name)
284#endif
285
286// Above the doxygen, to avoid confusing it
287#ifndef PICO_TIME_CRITICAL_PLACEMENT
288#define PICO_TIME_CRITICAL_PLACEMENT __in_ram
289#endif
290
318#ifndef __time_critical_func
319#define __time_critical_func(func_name) PICO_TIME_CRITICAL_PLACEMENT(__STRING(func_name)) func_name
320#endif
321
331#ifndef __no_inline_time_critical_func
332#define __no_inline_time_critical_func(func_name) __noinline __time_critical_func(func_name)
333#endif
334
335#else
336
337#ifndef RAM_SECTION_NAME
338#define RAM_SECTION_NAME(x) .time_critical.##x
339#endif
340
341#ifndef SECTION_NAME
342#define SECTION_NAME(x) .text.##x
343#endif
344
345#endif // !__ASSEMBLER__
346
347#endif
348