-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Accidental use of printf will use the Newlib implementation which uses heap, thus causing an error message about missing :platform:heap module.
- Loading branch information
Showing
4 changed files
with
112 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/* | ||
* Copyright (c) 2024, Niklas Hauser | ||
* | ||
* This file is part of the modm project. | ||
* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
// ---------------------------------------------------------------------------- | ||
|
||
#include <stdarg.h> | ||
#include <stddef.h> | ||
#include <modm/architecture/utils.hpp> | ||
|
||
// ---------------------------------------------------------------------------- | ||
modm_weak modm_section("{{ no_printf_section }}") | ||
int vprintf(const char* format, va_list arg) | ||
{ | ||
(void) format; | ||
(void) arg; | ||
return 0; | ||
} | ||
|
||
modm_weak modm_section("{{ no_printf_section }}") | ||
int vsnprintf(char* s, size_t n, const char* format, va_list arg) | ||
{ | ||
(void) s; | ||
(void) n; | ||
(void) format; | ||
(void) arg; | ||
return 0; | ||
} | ||
|
||
modm_weak modm_section("{{ no_printf_section }}") | ||
int vsprintf(char* s, const char* format, va_list arg) | ||
{ | ||
(void) s; | ||
(void) format; | ||
(void) arg; | ||
return 0; | ||
} | ||
|
||
modm_weak modm_section("{{ no_printf_section }}") | ||
int vfctprintf(void (*out)(char c, void* extra_arg), void* extra_arg, const char* format, va_list arg) | ||
{ | ||
(void) out; | ||
(void) extra_arg; | ||
(void) format; | ||
(void) arg; | ||
return 0; | ||
} | ||
|
||
modm_weak modm_section("{{ no_printf_section }}") | ||
int printf(const char* format, ...) | ||
{ | ||
(void) format; | ||
return 0; | ||
} | ||
|
||
modm_weak modm_section("{{ no_printf_section }}") | ||
int sprintf(char* s, const char* format, ...) | ||
{ | ||
(void) s; | ||
(void) format; | ||
return 0; | ||
} | ||
|
||
modm_weak modm_section("{{ no_printf_section }}") | ||
int snprintf(char* s, size_t n, const char* format, ...) | ||
{ | ||
(void) s; | ||
(void) n; | ||
(void) format; | ||
return 0; | ||
} | ||
|
||
modm_weak modm_section("{{ no_printf_section }}") | ||
int fctprintf(void (*out)(char c, void* extra_arg), void* extra_arg, const char* format, ...) | ||
{ | ||
(void) out; | ||
(void) extra_arg; | ||
(void) format; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters