Skip to content

Commit

Permalink
Resident in RAM definitions.
Browse files Browse the repository at this point in the history
  • Loading branch information
tzarc committed Nov 21, 2023
1 parent 68722d3 commit a52a277
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
9 changes: 9 additions & 0 deletions platforms/arm_atsam/_util.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Copyright 2023 Nick Brassel (@tzarc)
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once

#define RESIDENT_IN_RAM(funcname) __attribute__((section(".ramfunc." #funcname), noinline)) funcname

#if __has_include_next("_util.h")
# include_next "_util.h"
#endif
10 changes: 10 additions & 0 deletions platforms/avr/_util.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Copyright 2023 Nick Brassel (@tzarc)
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once

// AVR can't actually run anything from RAM, so just no-op the define.
#define RESIDENT_IN_RAM(funcname) funcname

#if __has_include_next("_util.h")
# include_next "_util.h"
#endif
9 changes: 9 additions & 0 deletions platforms/chibios/_util.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Copyright 2023 Nick Brassel (@tzarc)
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once

#define RESIDENT_IN_RAM(funcname) __attribute__((section(".ram0_init." #funcname), noinline)) funcname

#if __has_include_next("_util.h")
# include_next "_util.h"
#endif
4 changes: 4 additions & 0 deletions quantum/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,7 @@
#if !defined(PACKED)
# define PACKED __attribute__((__packed__))
#endif

#if __has_include("_util.h")
# include "_util.h" /* Include the platform's _util.h */
#endif

0 comments on commit a52a277

Please sign in to comment.