Skip to content

Commit 60c862c

Browse files
committed
Merge pull request #1795 from 0xc0170/dev_mbedos_additions
Small changes (docs plus assert)
2 parents 11c482c + 985255d commit 60c862c

File tree

5 files changed

+27
-7
lines changed

5 files changed

+27
-7
lines changed

hal/api/CThunk.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@
1919
* See the License for the specific language governing permissions and
2020
* limitations under the License.
2121
*/
22+
23+
/* General C++ Object Thunking class
24+
*
25+
* - allows direct callbacks to non-static C++ class functions
26+
* - keeps track for the corresponding class instance
27+
* - supports an optional context parameter for the called function
28+
* - ideally suited for class object receiving interrupts (NVIC_SetVector)
29+
*/
30+
2231
#ifndef __CTHUNK_H__
2332
#define __CTHUNK_H__
2433

hal/api/DirHandle.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class DirHandle {
8282
*
8383
* @param location The location to seek to. Must be a value returned by telldir.
8484
*/
85-
virtual void seekdir(off_t location) { }
85+
virtual void seekdir(off_t location) { (void)location;}
8686

8787
virtual ~DirHandle() {}
8888
};

hal/api/FileSystemLike.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class FileSystemLike : public FileBase {
6161
* @param filename the name of the file to remove.
6262
* @param returns 0 on success, -1 on failure.
6363
*/
64-
virtual int remove(const char *filename) { return -1; };
64+
virtual int remove(const char *filename) { (void) filename; return -1; };
6565

6666
/** Rename a file in the filesystem.
6767
*
@@ -72,7 +72,7 @@ class FileSystemLike : public FileBase {
7272
* 0 on success,
7373
* -1 on failure.
7474
*/
75-
virtual int rename(const char *oldname, const char *newname) { return -1; };
75+
virtual int rename(const char *oldname, const char *newname) { (void) oldname, (void) newname; return -1; };
7676

7777
/** Opens a directory in the filesystem and returns a DirHandle
7878
* representing the directory stream.
@@ -83,7 +83,7 @@ class FileSystemLike : public FileBase {
8383
* A DirHandle representing the directory stream, or
8484
* NULL on failure.
8585
*/
86-
virtual DirHandle *opendir(const char *name) { return NULL; };
86+
virtual DirHandle *opendir(const char *name) { (void) name; return NULL; };
8787

8888
/** Creates a directory in the filesystem.
8989
*
@@ -94,7 +94,7 @@ class FileSystemLike : public FileBase {
9494
* 0 on success,
9595
* -1 on failure.
9696
*/
97-
virtual int mkdir(const char *name, mode_t mode) { return -1; }
97+
virtual int mkdir(const char *name, mode_t mode) { (void) name, (void) mode; return -1; }
9898

9999
// TODO other filesystem functions (mkdir, rm, rn, ls etc)
100100
};

hal/api/mbed.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
// mbed Debug libraries
2929
#include "mbed_error.h"
3030
#include "mbed_interface.h"
31+
#include "mbed_assert.h"
3132

3233
// mbed Peripheral components
3334
#include "DigitalIn.h"

hal/common/assert.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,19 @@
1414
* limitations under the License.
1515
*/
1616
#include "mbed_assert.h"
17-
#include "mbed_error.h"
17+
#include "device.h"
18+
19+
#if DEVICE_STDIO_MESSAGES
20+
#include <stdio.h>
21+
#endif
22+
23+
#include <stdlib.h>
24+
#include "mbed_interface.h"
1825

1926
void mbed_assert_internal(const char *expr, const char *file, int line)
2027
{
21-
error("mbed assertation failed: %s, file: %s, line %d \n", expr, file, line);
28+
#if DEVICE_STDIO_MESSAGES
29+
fprintf(stderr, "mbed assertation failed: %s, file: %s, line %d \n", expr, file, line);
30+
#endif
31+
mbed_die();
2232
}

0 commit comments

Comments
 (0)