blob: 5dc9e6472d5c7bd5c1c98f1f38618c6aaa0245d3 [file] [log] [blame]
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +02001/*
2 * Copyright (c) 2018, Arm Limited. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6#ifndef __ASSERT_MACROS_S__
7#define __ASSERT_MACROS_S__
8
9 /*
10 * Assembler macro to enable asm_assert. We assume that the stack is
11 * initialized prior to invoking this macro. Please note that the
12 * macro makes use of label '300' to provide the logic and the
13 * caller should make sure that this label is not used to branch
14 * prior to calling this macro.
15 */
16#define ASM_ASSERT(_cc) \
17.ifndef .L_assert_filename ;\
18 .pushsection .rodata.str1.1, "aS" ;\
19 .L_assert_filename: ;\
20 .string __FILE__ ;\
21 .popsection ;\
22.endif ;\
23 b##_cc 300f ;\
24 ldr r0, =.L_assert_filename ;\
25 mov r1, #__LINE__ ;\
26 b asm_assert ;\
27300:
28
29#endif /* __ASSERT_MACROS_S__ */