Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add simpler method for relocating functions to RAM. #21804

Merged
merged 1 commit into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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