From b7ab9aa8f2920b39e39a30dfee99eea0a21e5a12 Mon Sep 17 00:00:00 2001 From: David Sidrane Date: Thu, 4 Jun 2020 06:34:33 -0700 Subject: [PATCH] nuttx compiler.h: Add location directive for code and data The ability to locate data and code in different sections is becomming critical and common place in cores with multiple bus matrices and power domains, where DMA can be limited to a specific memory. --- include/nuttx/compiler.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/nuttx/compiler.h b/include/nuttx/compiler.h index 1dd5b84f42..0bad09f147 100644 --- a/include/nuttx/compiler.h +++ b/include/nuttx/compiler.h @@ -103,10 +103,18 @@ # define farcall_function __attribute__ ((long_call)) +/* Code locate */ + +# define locate_code(n) __attribute__ ((section(n))) + /* Data alignment */ # define aligned_data(n) __attribute__ ((aligned(n))) +/* Data location */ + +# define locate_data(n) __attribute__ ((section(n))) + /* The packed attribute informs GCC that the structure elements are packed, * ignoring other alignment rules. */ @@ -336,7 +344,9 @@ */ # define noreturn_function +# define locate_code(n) # define aligned_data(n) +# define locate_data(n) # define begin_packed_struct # define end_packed_struct @@ -475,6 +485,8 @@ # define noreturn_function # define aligned_data(n) +# define locate_code(n) +# define locate_data(n) # define begin_packed_struct # define end_packed_struct # define naked_function @@ -575,7 +587,9 @@ # define weak_const_function # define noreturn_function # define farcall_function +# define locate_code(n) # define aligned_data(n) +# define locate_data(n) # define begin_packed_struct __packed # define end_packed_struct # define reentrant_function @@ -628,6 +642,8 @@ # define noreturn_function # define farcall_function # define aligned_data(n) +# define locate_code(n) +# define locate_data(n) # define begin_packed_struct # define end_packed_struct # define reentrant_function