Skip to content

Commit 5874c1c

Browse files
committed
stmhal: Remove #include <stdint.h> from mpconfigport.h.
Make include dependencies neater, and adheres to the coding convention that headers should not include headers.
1 parent e88814a commit 5874c1c

File tree

9 files changed

+19
-18
lines changed

9 files changed

+19
-18
lines changed

stmhal/bufhelper.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include "obj.h"
55
#include "bufhelper.h"
66

7-
void pyb_buf_get_for_send(mp_obj_t o, mp_buffer_info_t *bufinfo, uint8_t *tmp_data) {
7+
void pyb_buf_get_for_send(mp_obj_t o, mp_buffer_info_t *bufinfo, byte *tmp_data) {
88
if (MP_OBJ_IS_INT(o)) {
99
tmp_data[0] = mp_obj_get_int(o);
1010
bufinfo->buf = tmp_data;

stmhal/bufhelper.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
void pyb_buf_get_for_send(mp_obj_t o, mp_buffer_info_t *bufinfo, uint8_t *tmp_data);
1+
void pyb_buf_get_for_send(mp_obj_t o, mp_buffer_info_t *bufinfo, byte *tmp_data);
22
mp_obj_t pyb_buf_get_for_recv(mp_obj_t o, mp_buffer_info_t *bufinfo);

stmhal/gccollect.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ void gc_collect(void) {
4141
gc_info_t info;
4242
gc_info(&info);
4343
printf("GC@%lu %lums\n", start, ticks);
44-
printf(" %lu total\n", info.total);
45-
printf(" %lu : %lu\n", info.used, info.free);
46-
printf(" 1=%lu 2=%lu m=%lu\n", info.num_1block, info.num_2block, info.max_block);
44+
printf(" " UINT_FMT " total\n", info.total);
45+
printf(" " UINT_FMT " : " UINT_FMT "\n", info.used, info.free);
46+
printf(" 1=" UINT_FMT " 2=" UINT_FMT " m=" UINT_FMT "\n", info.num_1block, info.num_2block, info.max_block);
4747
}
4848
}
4949

stmhal/input.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#include <stdint.h>
2+
13
#include "mpconfig.h"
24
#include "nlr.h"
35
#include "misc.h"

stmhal/modos.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include <stdint.h>
12
#include <string.h>
23

34
#include "mpconfig.h"

stmhal/modpyb.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ STATIC mp_obj_t pyb_info(uint n_args, const mp_obj_t *args) {
8282
gc_info_t info;
8383
gc_info(&info);
8484
printf("GC:\n");
85-
printf(" %lu total\n", info.total);
86-
printf(" %lu : %lu\n", info.used, info.free);
87-
printf(" 1=%lu 2=%lu m=%lu\n", info.num_1block, info.num_2block, info.max_block);
85+
printf(" " UINT_FMT " total\n", info.total);
86+
printf(" " UINT_FMT " : " UINT_FMT "\n", info.used, info.free);
87+
printf(" 1=" UINT_FMT " 2=" UINT_FMT " m=" UINT_FMT "\n", info.num_1block, info.num_2block, info.max_block);
8888
}
8989

9090
// free space on flash

stmhal/mpconfigport.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#include <stdint.h>
2-
31
// options to control how Micro Python is built
42

53
#define MICROPY_EMIT_THUMB (1)
@@ -51,11 +49,11 @@ extern const struct _mp_obj_module_t time_module;
5149

5250
#define BYTES_PER_WORD (4)
5351

54-
#define UINT_FMT "%lu"
55-
#define INT_FMT "%ld"
52+
#define UINT_FMT "%u"
53+
#define INT_FMT "%d"
5654

57-
typedef int32_t machine_int_t; // must be pointer size
58-
typedef uint32_t machine_uint_t; // must be pointer size
55+
typedef int machine_int_t; // must be pointer size
56+
typedef unsigned int machine_uint_t; // must be pointer size
5957
typedef void *machine_ptr_t; // must be of pointer size
6058
typedef const void *machine_const_ptr_t; // must be of pointer size
6159

stmhal/pyexec.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ bool parse_compile_execute(mp_lexer_t *lex, mp_parse_input_kind_t input_kind, bo
8484
gc_info_t info;
8585
gc_info(&info);
8686
printf("GC:\n");
87-
printf(" %lu total\n", info.total);
88-
printf(" %lu : %lu\n", info.used, info.free);
89-
printf(" 1=%lu 2=%lu m=%lu\n", info.num_1block, info.num_2block, info.max_block);
87+
printf(" " UINT_FMT " total\n", info.total);
88+
printf(" " UINT_FMT " : " UINT_FMT "\n", info.used, info.free);
89+
printf(" 1=" UINT_FMT " 2=" UINT_FMT " m=" UINT_FMT "\n", info.num_1block, info.num_2block, info.max_block);
9090
}
9191
}
9292

stmhal/timer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ void timer_irq_handler(uint tim_id) {
467467
// Uncaught exception; disable the callback so it doesn't run again.
468468
tim->callback = mp_const_none;
469469
__HAL_TIM_DISABLE_IT(&tim->tim, TIM_IT_UPDATE);
470-
printf("Uncaught exception in Timer(%lu) interrupt handler\n", tim->tim_id);
470+
printf("Uncaught exception in Timer(" UINT_FMT ") interrupt handler\n", tim->tim_id);
471471
mp_obj_print_exception((mp_obj_t)nlr.ret_val);
472472
}
473473
gc_unlock();

0 commit comments

Comments
 (0)