Skip to content

Commit ccc92c0

Browse files
authored
Use latest GCC and add helpful errors (#388)
1 parent 63531d7 commit ccc92c0

5 files changed

Lines changed: 27 additions & 15 deletions

File tree

NetX/src/u_nx_ethernet.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ static void _receive_message(NX_UDP_SOCKET *socket) {
122122

123123
/* Process received message */
124124
if(status == NX_SUCCESS) {
125-
PRINTLN_INFO("Received ethernet message! (Sender ID: %d, Message ID: %d, bytes_copied: %d).", message.sender_id, message.message_id, bytes_copied);
125+
PRINTLN_INFO("Received ethernet message! (Sender ID: %d, Message ID: %d, bytes_copied: %ld).", message.sender_id, message.message_id, bytes_copied);
126126
device.on_recieve(message);
127127
}
128128
}

dev/Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ RUN ln -sf /usr/lib/linux-tools-*/* /usr/bin/
5454

5555
# Install cross compiler
5656
RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
57-
wget -qO- https://developer.arm.com/-/media/Files/downloads/gnu/11.3.rel1/binrel/arm-gnu-toolchain-11.3.rel1-aarch64-arm-none-eabi.tar.xz | tar -xJv; \
57+
wget -qO- https://developer.arm.com/-/media/Files/downloads/gnu/15.2.rel1/binrel/arm-gnu-toolchain-15.2.rel1-aarch64-arm-none-eabi.tar.xz | tar -xJv; \
5858
else \
59-
wget -qO- https://developer.arm.com/-/media/Files/downloads/gnu/11.3.rel1/binrel/arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-eabi.tar.xz | tar -xJv; \
59+
wget -qO- https://developer.arm.com/-/media/Files/downloads/gnu/15.2.rel1/binrel/arm-gnu-toolchain-15.2.rel1-x86_64-arm-none-eabi.tar.xz | tar -xJv; \
6060
fi
6161

62-
ENV PATH $PATH:/home/dev/arm-gnu-toolchain-11.3.rel1-aarch64-arm-none-eabi/bin
63-
ENV PATH $PATH:/home/dev/arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-eabi/bin
62+
ENV PATH $PATH:/home/dev/arm-gnu-toolchain-15.2.rel1-aarch64-arm-none-eabi/bin
63+
ENV PATH $PATH:/home/dev/arm-gnu-toolchain-15.2.rel1-x86_64-arm-none-eabi/bin
6464

6565
# build and install customized openocd
6666
RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \

general/src/sht30.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,4 +105,4 @@ uint8_t sht30_get_temp_humid(sht30_t *sht30)
105105
float humVal = (100.0f * ((float)humidity / 65535.0f));
106106
sht30->humidity = humVal;
107107
return 0;
108-
};
108+
}

middleware/src/c_utils.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ unsigned char reverse_bits(unsigned char b)
2626

2727
float linear_interpolate(float x, float x1, float x2, float y1, float y2)
2828
{
29-
assert(fabs(x2 - x1) > FLOAT_EPSILON);
29+
assert(fabsf(x2 - x1) > FLOAT_EPSILON);
3030

3131
return y1 + ((x - x1) * (y2 - y1) / (x2 - x1));
3232
}
@@ -40,4 +40,4 @@ void uint16_to_uint8(uint16_t value, uint8_t arr[2])
4040
{
4141
arr[1] = (uint8_t)value;
4242
arr[0] = (uint8_t)(value >> 8);
43-
}
43+
}

threadX/inc/u_tx_debug.h

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
/* Gets the name of the file. */
1818
#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
1919

20-
/* DEBUG MESSAGE LEVELS */
20+
/* DEBUG MESSAGE LEVELS */
2121
/* These can be commented out to enable/disable printing of the associated debug messages. */
2222
#define LOG_ERROR /* Messages indicating that something has definitely gone wrong. */
2323
#define LOG_WARNING /* Messages indicating that something 'might' have gone wrong, but either isn't immidietely critical or is only a problem in certain contexts. */
@@ -35,21 +35,33 @@
3535

3636
/* PRINTLN_ERROR() */
3737
#if defined(LOG_ERROR) && !defined(NO_LOG)
38-
#define PRINTLN_ERROR(message, ...) printf("[%s/%s()] ERROR: " message "\n", __FILENAME__, __func__, ##__VA_ARGS__) /* Prints an ERROR message in the format: "[file_name.c/function()] ERROR: {message}"*/
38+
#define PRINTLN_ERROR(message, ...) \
39+
_Pragma("GCC diagnostic push") \
40+
_Pragma("GCC diagnostic ignored \"-Wdouble-promotion\"") \
41+
printf("[%s/%s()] ERROR: " message "\n", __FILENAME__, __func__, ##__VA_ARGS__) /* Prints an ERROR message in the format: "[file_name.c/function()] ERROR: {message}"*/
42+
_Pragma("GCC diagnostic pop")
3943
#else
4044
#define PRINTLN_ERROR(message, ...) /* If debugging is turned off, macro doesn't need to expand to anything. */
4145
#endif
4246

4347
/* PRINTLN_WARNING() */
4448
#if defined(LOG_WARNING) && !defined(NO_LOG)
45-
#define PRINTLN_WARNING(message, ...) printf("[%s/%s()] WARNING: " message "\n", __FILENAME__, __func__, ##__VA_ARGS__) /* Prints a WARNING message in the format: "[file_name.c/function()] WARNING: {message}"*/
49+
#define PRINTLN_WARNING(message, ...) \
50+
_Pragma("GCC diagnostic push") \
51+
_Pragma("GCC diagnostic ignored \"-Wdouble-promotion\"") \
52+
printf("[%s/%s()] WARNING: " message "\n", __FILENAME__, __func__, ##__VA_ARGS__) /* Prints a WARNING message in the format: "[file_name.c/function()] WARNING: {message}"*/
53+
_Pragma("GCC diagnostic pop")
4654
#else
4755
#define PRINTLN_WARNING(message, ...) /* If debugging is turned off, macro doesn't need to expand to anything. */
4856
#endif
4957

5058
/* PRINTLN_INFO() */
5159
#if defined(LOG_INFO) && !defined(NO_LOG)
52-
#define PRINTLN_INFO(message, ...) printf("[%s/%s()] INFO: " message "\n", __FILENAME__, __func__, ##__VA_ARGS__) /* Prints an INFO message in the format: "[file_name.c/function()] INFO: {message}"*/
60+
#define PRINTLN_INFO(message, ...) \
61+
_Pragma("GCC diagnostic push") \
62+
_Pragma("GCC diagnostic ignored \"-Wdouble-promotion\"") \
63+
printf("[%s/%s()] INFO: " message "\n", __FILENAME__, __func__, ##__VA_ARGS__) /* Prints an INFO message in the format: "[file_name.c/function()] INFO: {message}"*/
64+
_Pragma("GCC diagnostic pop")
5365
#else
5466
#define PRINTLN_INFO(message, ...) /* If debugging is turned off, macro doesn't need to expand to anything. */
5567
#endif
@@ -58,8 +70,8 @@
5870
* @brief Checks if a function is successful when called. Prints an error message if it fails.
5971
* @param function_call The function to call.
6072
* @param success The function's success code/macro (e.g., U_SUCCESS, TX_SUCCESS, etc.).
61-
*
62-
* @note This macro intentionally doesn't support custom error messages, for the sake of readability. If an error is complex enough to
73+
*
74+
* @note This macro intentionally doesn't support custom error messages, for the sake of readability. If an error is complex enough to
6375
* require a custom message, the error should probably be checked manually and PRINTLN_ERROR() called directly.
6476
*/
6577
#define CATCH_ERROR(function_call, success) do { \
@@ -82,4 +94,4 @@ const char *hal_status_toString(HAL_StatusTypeDef status);
8294

8395
// clang-format on
8496

85-
#endif
97+
#endif

0 commit comments

Comments
 (0)