1/* 2 * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7#include "pico.h" 8 9#ifdef __riscv 10// Get macros for convenient use of Hazard3 instructions without binutils support 11#include "hardware/hazard3/instructions.h" 12#endif 13 14#if !PICO_ASSEMBLER_IS_CLANG 15#define apsr_nzcv r15 16#endif 17// note we don't do this by default in this file for backwards comaptibility with user code 18// that may include this file, but not use unified syntax. Note that this macro does equivalent 19// setup to the pico_default_asm macro for inline assembly in C code. 20.macro pico_default_asm_setup 21#ifndef __riscv 22.syntax unified 23.cpu cortex-m33 24.fpu fpv5-sp-d16 25.thumb 26#endif 27.endm 28 29// do not put align in here as it is used mid function sometimes 30.macro regular_func x 31.global \x 32.type \x,%function 33#ifndef __riscv 34.thumb_func 35#endif 36\x: 37.endm 38 39.macro weak_func x 40.weak \x 41.type \x,%function 42#ifndef __riscv 43.thumb_func 44#endif 45\x: 46.endm 47 48.macro regular_func_with_section x 49.section .text.\x 50regular_func \x 51.endm 52 53// do not put align in here as it is used mid function sometimes 54.macro wrapper_func x 55regular_func WRAPPER_FUNC_NAME(\x) 56.endm 57 58.macro weak_wrapper_func x 59weak_func WRAPPER_FUNC_NAME(\x) 60.endm 61 62.macro __pre_init_with_offset func, offset, priority_string1 63.section .preinit_array.\priority_string1 64.p2align 2 65.word \func + \offset 66.endm 67 68// backwards compatibility 69.macro __pre_init func, priority_string1 70__pre_init_with_offset func, 0, priority_string1 71.endm 72