[realtek-ambz2] Add initial SDK fixups and API layer

This commit is contained in:
Kuba Szczodrzyński
2023-05-23 12:11:17 +02:00
parent 07e9aa1ded
commit 8c636e44f7
14 changed files with 91 additions and 41 deletions

View File

@@ -1,8 +0,0 @@
/* Copyright (c) Kuba Szczodrzyński 2023-03-02. */
// fix conflicting declaration with ArduinoCore-API
#ifdef ARDUINO
#define boolean boolean_rtl
#endif
#include_next "basic_types.h"
#undef boolean

View File

@@ -1,21 +0,0 @@
/* Copyright (c) Kuba Szczodrzyński 2023-03-12. */
#include_next <machine/endian.h>
#pragma once
// GCC versions newer than 5.x.x specify the LITTLE_ENDIAN macro
// as an alias to _LITTLE_ENDIAN (which in turn holds the actual numeric value).
// Realtek's rtl8711b_crypto.h redefines _LITTLE_ENDIAN as a macro without
// any value, which makes comparisons like '#if BYTE_ORDER == LITTLE_ENDIAN' impossible.
#if __GNUC__ > 5
#undef _LITTLE_ENDIAN
#undef _BIG_ENDIAN
#undef LITTLE_ENDIAN
#undef BIG_ENDIAN
#undef BYTE_ORDER
#define LITTLE_ENDIAN 1234
#define BIG_ENDIAN 4321
#define BYTE_ORDER LITTLE_ENDIAN
#endif

View File

@@ -1,3 +0,0 @@
/* Copyright (c) Kuba Szczodrzyński 2023-03-14. */
#include "../platform_stdlib.h"

View File

@@ -1,22 +0,0 @@
/* Copyright (c) Kuba Szczodrzyński 2023-03-14. */
#pragma once
// platform_stdlib.h in amb1_sdk includes some stdlib headers,
// as well as Realtek's stdlib replacement headers. It also defines
// some macros to map stdlib functions to SDK functions, so it's
// generally just not needed at all.
// This is also the only file that publicly includes strproc.h and memproc.h,
// so this fixup resolves all these issues.
#include <stdarg.h> /* va_list */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "basic_types.h" // fixup: replaces typedef boolean for Arduino compatibility
#include "memproc.h" // fixup: redirects to stdlib
#include "strproc.h" // fixup: redirects to stdlib
#include "diag.h"

View File

@@ -1,6 +0,0 @@
/* Copyright (c) Kuba Szczodrzyński 2023-03-02. */
// section_config.h is in the same directory as basic_types.h
// make the former include a fixup instead
#include "basic_types.h"
#include_next "section_config.h"