Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1712cb4

Browse files
authored
Core renesas / Storage library, Fix for #366 (Name conflict in library Storage) (#370)
* renaming storage debug function to avoid clash with user code
1 parent 0281be5 commit 1712cb4

File tree

6 files changed

+26
-15
lines changed

6 files changed

+26
-15
lines changed

‎libraries/BlockDevices/CodeFlashBlockDevice.cpp‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919

2020
#include "CodeFlashBlockDevice.h"
2121

22+
#define debug_if rns_storage_dbg_if
23+
#define debug_mem rns_storage_dbg_mem
24+
2225
// To enable debug set CF_DBG to 1 and make sure STORAGE_DEBUG is defined
2326
// in Storage/storage_common.h
2427
#define CF_DBG 0

‎libraries/BlockDevices/MBRBlockDevice.cpp‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
#include <algorithm>
2020
#include <string.h>
2121

22+
#define debug_if rns_storage_dbg_if
23+
#define debug_mem rns_storage_dbg_mem
24+
2225
// To enable debug set MBR_DBG to 1 and make sure STORAGE_DEBUG is defined
2326
// in Storage/storage_common.h
2427
#define MBR_DBG 0

‎libraries/BlockDevices/QSPIFlashBlockDevice.cpp‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
/* ########################################################################## */
2020
#include "QSPIFlashBlockDevice.h"
2121

22+
#define debug_if rns_storage_dbg_if
23+
#define debug_mem rns_storage_dbg_mem
24+
2225
#ifdef HAS_QSPI
2326

2427
// To enable debug set QSPIF_DBG to 1 and make sure STORAGE_DEBUG is defined

‎libraries/FATFilesystem/FATFileSystem.cpp‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
#include <errno.h>
2626
#include <stdlib.h>
2727

28+
#define debug_if rns_storage_dbg_if
29+
2830
//namespace mbed {
2931

3032
//using namespace mbed;

‎libraries/Storage/storage_common.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#ifdef STORAGE_DEBUG
55

6-
char debug_buffer[STORAGE_BUFF_DIM];
6+
char rns_storage_dbg_buf[STORAGE_BUFF_DIM];
77

88
#endif
99

‎libraries/Storage/storage_common.h‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,21 @@ extern "C" {
1818
#define STORAGE_BUFF_DIM 512
1919
#define PRINT_SIZE 32
2020

21-
extern char debug_buffer[STORAGE_BUFF_DIM];
21+
extern char rns_storage_dbg_buf[STORAGE_BUFF_DIM];
2222

2323
/** Output a debug message
2424
*
2525
* @param format printf-style format string, followed by variables
2626
*/
27-
static inline void debug(const char *fmt, ...)
27+
static inline void rns_storage_dbg(const char *fmt, ...)
2828
{
29-
memset(debug_buffer,0x00,256);
29+
memset(rns_storage_dbg_buf,0x00,256);
3030
va_list va;
3131
va_start (va, fmt);
32-
vsnprintf (debug_buffer,STORAGE_BUFF_DIM, fmt, va);
32+
vsnprintf (rns_storage_dbg_buf,STORAGE_BUFF_DIM, fmt, va);
3333
va_end (va);
3434
if(Serial)
35-
Serial.println(debug_buffer);
35+
Serial.println(rns_storage_dbg_buf);
3636
}
3737

3838

@@ -44,20 +44,20 @@ static inline void debug(const char *fmt, ...)
4444
* @param condition output only if condition is true (!= 0)
4545
* @param format printf-style format string, followed by variables
4646
*/
47-
static inline void debug_if(int condition, const char *fmt, ...)
47+
static inline void rns_storage_dbg_if(int condition, const char *fmt, ...)
4848
{
4949
if (condition) {
50-
memset(debug_buffer,0x00,256);
50+
memset(rns_storage_dbg_buf,0x00,256);
5151
va_list va;
5252
va_start (va, fmt);
53-
vsnprintf (debug_buffer,STORAGE_BUFF_DIM, fmt, va);
53+
vsnprintf (rns_storage_dbg_buf,STORAGE_BUFF_DIM, fmt, va);
5454
va_end (va);
5555
if(Serial)
56-
Serial.println(debug_buffer);
56+
Serial.println(rns_storage_dbg_buf);
5757
}
5858
}
5959

60-
static inline void debug_mem(uint8_t *b, uint32_t _size)
60+
static inline void rns_storage_dbg_mem(uint8_t *b, uint32_t _size)
6161
{
6262
if (b != nullptr) {
6363
Serial.println("");
@@ -76,16 +76,16 @@ static inline void debug_mem(uint8_t *b, uint32_t _size)
7676

7777
#else
7878

79-
static inline void debug_if(int condition, const char *format, ...) {
79+
static inline void rns_storage_dbg_if(int condition, const char *format, ...) {
8080
(void)condition;
8181
(void)format;
8282
}
8383

84-
static inline void debug(const char *format, ...) {
84+
static inline void rns_storage_dbg(const char *format, ...) {
8585
(void)format;
8686
}
8787

88-
static inline void debug_mem(uint8_t *b, uint32_t _size) {
88+
static inline void rns_storage_dbg_mem(uint8_t *b, uint32_t _size) {
8989
(void)b;
9090
(void)_size;
9191
}
@@ -98,7 +98,7 @@ static inline void debug_mem(uint8_t *b, uint32_t _size) {
9898

9999
#ifdef STORAGE_ASSERT
100100
#define MBED_ASSERT(expr) do { if (!(expr)) { \
101-
debug("ASSERT FAILED at line %d in file %s",__LINE__,__FILE__); }} while(0)
101+
rns_storage_dbg("ASSERT FAILED at line %d in file %s",__LINE__,__FILE__); }} while(0)
102102
#else
103103
#define MBED_ASSERT(expr)
104104
#endif

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /