diff --git a/core/include/esp/timer_private.h b/core/include/esp/timer_private.h index 530a396..a5fc246 100644 --- a/core/include/esp/timer_private.h +++ b/core/include/esp/timer_private.h @@ -193,7 +193,7 @@ INLINED bool _timer_set_frequency_impl(const timer_frc_t frc, uint32_t freq) counts = timer_freq_to_count(frc, freq, div); if(counts == 0) { - printf("ABORT: No counter for timer %u frequency %lu\r\n", frc, freq); + printf("ABORT: No counter for timer %u frequency %u\r\n", frc, freq); abort(); } diff --git a/examples/bmp180_i2c/bmp180_i2c.c b/examples/bmp180_i2c/bmp180_i2c.c index 76b3705..15c0508 100644 --- a/examples/bmp180_i2c/bmp180_i2c.c +++ b/examples/bmp180_i2c/bmp180_i2c.c @@ -73,7 +73,7 @@ void bmp180_task(void *pvParameters) bmp180_trigger_measurement(com_queue); break; case MY_EVT_BMP180: - printf("%s: Received BMP180 Event temp:=%ld.%d°C press=%ld.%02ldhPa\n", __FUNCTION__, \ + printf("%s: Received BMP180 Event temp:=%d.%d°C press=%d.%02dhPa\n", __FUNCTION__, \ (int32_t)ev.bmp180_data.temperatue, abs((int32_t)(ev.bmp180_data.temperatue*10)%10), \ ev.bmp180_data.pressure/100, ev.bmp180_data.pressure%100 ); break; diff --git a/examples/button/button.c b/examples/button/button.c index bcca2b3..e197ffc 100644 --- a/examples/button/button.c +++ b/examples/button/button.c @@ -34,7 +34,7 @@ void buttonPollTask(void *pvParameters) { taskYIELD(); } - printf("Polled for button press at %ldms\r\n", xTaskGetTickCount()*portTICK_RATE_MS); + printf("Polled for button press at %dms\r\n", xTaskGetTickCount()*portTICK_RATE_MS); vTaskDelay(200 / portTICK_RATE_MS); } } @@ -59,7 +59,7 @@ void buttonIntTask(void *pvParameters) xQueueReceive(*tsqueue, &button_ts, portMAX_DELAY); button_ts *= portTICK_RATE_MS; if(last < button_ts-200) { - printf("Button interrupt fired at %ldms\r\n", button_ts); + printf("Button interrupt fired at %dms\r\n", button_ts); last = button_ts; } } diff --git a/examples/experiments/timers/timers.c b/examples/experiments/timers/timers.c index a840159..2a11bec 100644 --- a/examples/experiments/timers/timers.c +++ b/examples/experiments/timers/timers.c @@ -20,8 +20,8 @@ IRAM void dump_frc1_seq(void) uint32_t f1_a = TIMER(0).COUNT; uint32_t f1_b = TIMER(0).COUNT; uint32_t f1_c = TIMER(0).COUNT; - printf("FRC1 sequence 0x%08lx 0x%08lx 0x%08lx\r\n", f1_a, f1_b, f1_c); - printf("FRC1 deltas %ld %ld \r\n", f1_b-f1_a, f1_c-f1_b); + printf("FRC1 sequence 0x%08x 0x%08x 0x%08x\r\n", f1_a, f1_b, f1_c); + printf("FRC1 deltas %d %d \r\n", f1_b-f1_a, f1_c-f1_b); } IRAM void dump_frc2_seq(void) @@ -37,8 +37,8 @@ IRAM void dump_frc2_seq(void) uint32_t f2_a = TIMER(1).COUNT; uint32_t f2_b = TIMER(1).COUNT; uint32_t f2_c = TIMER(1).COUNT; - printf("FRC2 sequence 0x%08lx 0x%08lx 0x%08lx\r\n", f2_a, f2_b, f2_c); - printf("FRC2 deltas %ld %ld \r\n", f2_b-f2_a, f2_c-f2_b); + printf("FRC2 sequence 0x%08x 0x%08x 0x%08x\r\n", f2_a, f2_b, f2_c); + printf("FRC2 deltas %d %d \r\n", f2_b-f2_a, f2_c-f2_b); } IRAM void dump_timer_regs(const char *msg) @@ -56,7 +56,7 @@ IRAM void dump_timer_regs(const char *msg) for(int i = 0; i < DUMP_SZ; i++) { if(i % 4 == 0) printf("%s0x%02x: ", i ? "\r\n" : "", i*4); - printf("%08lx ", chunk[i]); + printf("%08x ", chunk[i]); } printf("\r\n"); @@ -77,7 +77,7 @@ static volatile uint32_t frc1_last_count_val; void timerRegTask(void *pvParameters) { while(1) { - printf("state at task tick count %ld:\r\n", xTaskGetTickCount()); + printf("state at task tick count %d:\r\n", xTaskGetTickCount()); dump_timer_regs(""); /* @@ -87,10 +87,10 @@ void timerRegTask(void *pvParameters) printf("INUM_MAX count %d\r\n", max_count); */ - printf("frc1 handler called %ld times, last value 0x%08lx\r\n", frc1_handler_call_count, + printf("frc1 handler called %d times, last value 0x%08x\r\n", frc1_handler_call_count, frc1_last_count_val); - printf("frc2 handler called %ld times, last value 0x%08lx\r\n", frc2_handler_call_count, + printf("frc2 handler called %d times, last value 0x%08x\r\n", frc2_handler_call_count, frc2_last_count_val); vTaskDelay(500 / portTICK_RATE_MS); diff --git a/examples/ota_basic/ota_basic.c b/examples/ota_basic/ota_basic.c index 23df052..69751d0 100644 --- a/examples/ota_basic/ota_basic.c +++ b/examples/ota_basic/ota_basic.c @@ -26,7 +26,7 @@ void user_init(void) printf("Image addresses in flash:\r\n"); for(int i = 0; i -/* - * Guess on types by examining *_MIN / *_MAX defines. - */ -#if __GNUC_PREREQ (3, 3) -/* GCC >= 3.3.0 has ____ implicitly defined. */ -#define __EXP(x) __##x##__ -#else -/* Fall back to POSIX versions from */ -#define __EXP(x) x -#include -#endif - #ifdef __cplusplus extern "C" { #endif -#ifdef __INT8_TYPE__ -typedef __INT8_TYPE__ __int8_t; -#ifdef __UINT8_TYPE__ -typedef __UINT8_TYPE__ __uint8_t; -#else -typedef unsigned __INT8_TYPE__ __uint8_t; -#endif -#define ___int8_t_defined 1 -#elif __EXP(SCHAR_MAX) == 0x7f typedef signed char __int8_t ; typedef unsigned char __uint8_t ; #define ___int8_t_defined 1 -#endif -#ifdef __INT16_TYPE__ -typedef __INT16_TYPE__ __int16_t; -#ifdef __UINT16_TYPE__ -typedef __UINT16_TYPE__ __uint16_t; -#else -typedef unsigned __INT16_TYPE__ __uint16_t; -#endif -#define ___int16_t_defined 1 -#elif __EXP(INT_MAX) == 0x7fff -typedef signed int __int16_t; -typedef unsigned int __uint16_t; -#define ___int16_t_defined 1 -#elif __EXP(SHRT_MAX) == 0x7fff typedef signed short __int16_t; typedef unsigned short __uint16_t; #define ___int16_t_defined 1 -#elif __EXP(SCHAR_MAX) == 0x7fff -typedef signed char __int16_t; -typedef unsigned char __uint16_t; -#define ___int16_t_defined 1 -#endif -#ifdef __INT32_TYPE__ -typedef __INT32_TYPE__ __int32_t; -#ifdef __UINT32_TYPE__ -typedef __UINT32_TYPE__ __uint32_t; -#else -typedef unsigned __INT32_TYPE__ __uint32_t; -#endif -#define ___int32_t_defined 1 -#elif __EXP(INT_MAX) == 0x7fffffffL typedef signed int __int32_t; typedef unsigned int __uint32_t; #define ___int32_t_defined 1 -#elif __EXP(LONG_MAX) == 0x7fffffffL -typedef signed long __int32_t; -typedef unsigned long __uint32_t; -#define ___int32_t_defined 1 -#elif __EXP(SHRT_MAX) == 0x7fffffffL -typedef signed short __int32_t; -typedef unsigned short __uint32_t; -#define ___int32_t_defined 1 -#elif __EXP(SCHAR_MAX) == 0x7fffffffL -typedef signed char __int32_t; -typedef unsigned char __uint32_t; -#define ___int32_t_defined 1 -#endif -#ifdef __INT64_TYPE__ -typedef __INT64_TYPE__ __int64_t; -#ifdef __UINT64_TYPE__ -typedef __UINT64_TYPE__ __uint64_t; -#else -typedef unsigned __INT64_TYPE__ __uint64_t; -#endif -#define ___int64_t_defined 1 -#elif __EXP(LONG_MAX) > 0x7fffffff -typedef signed long __int64_t; -typedef unsigned long __uint64_t; -#define ___int64_t_defined 1 - -/* GCC has __LONG_LONG_MAX__ */ -#elif defined(__LONG_LONG_MAX__) && (__LONG_LONG_MAX__ > 0x7fffffff) typedef signed long long __int64_t; typedef unsigned long long __uint64_t; #define ___int64_t_defined 1 -/* POSIX mandates LLONG_MAX in */ -#elif defined(LLONG_MAX) && (LLONG_MAX > 0x7fffffff) -typedef signed long long __int64_t; -typedef unsigned long long __uint64_t; -#define ___int64_t_defined 1 - -#elif __EXP(INT_MAX) > 0x7fffffff -typedef signed int __int64_t; -typedef unsigned int __uint64_t; -#define ___int64_t_defined 1 -#endif - -#ifdef __INT_LEAST8_TYPE__ -typedef __INT_LEAST8_TYPE__ __int_least8_t; -#ifdef __UINT_LEAST8_TYPE__ -typedef __UINT_LEAST8_TYPE__ __uint_least8_t; -#else -typedef unsigned __INT_LEAST8_TYPE__ __uint_least8_t; -#endif -#define ___int_least8_t_defined 1 -#elif defined(___int8_t_defined) typedef __int8_t __int_least8_t; typedef __uint8_t __uint_least8_t; -#define ___int_least8_t_defined 1 -#elif defined(___int16_t_defined) -typedef __int16_t __int_least8_t; -typedef __uint16_t __uint_least8_t; -#define ___int_least8_t_defined 1 -#elif defined(___int32_t_defined) -typedef __int32_t __int_least8_t; -typedef __uint32_t __uint_least8_t; -#define ___int_least8_t_defined 1 -#elif defined(___int64_t_defined) -typedef __int64_t __int_least8_t; -typedef __uint64_t __uint_least8_t; -#define ___int_least8_t_defined 1 -#endif +#define ___int_least8_t_defined -#ifdef __INT_LEAST16_TYPE__ -typedef __INT_LEAST16_TYPE__ __int_least16_t; -#ifdef __UINT_LEAST16_TYPE__ -typedef __UINT_LEAST16_TYPE__ __uint_least16_t; -#else -typedef unsigned __INT_LEAST16_TYPE__ __uint_least16_t; -#endif -#define ___int_least16_t_defined 1 -#elif defined(___int16_t_defined) typedef __int16_t __int_least16_t; typedef __uint16_t __uint_least16_t; -#define ___int_least16_t_defined 1 -#elif defined(___int32_t_defined) -typedef __int32_t __int_least16_t; -typedef __uint32_t __uint_least16_t; -#define ___int_least16_t_defined 1 -#elif defined(___int64_t_defined) -typedef __int64_t __int_least16_t; -typedef __uint64_t __uint_least16_t; -#define ___int_least16_t_defined 1 -#endif +#define ___int_least16_t_defined -#ifdef __INT_LEAST32_TYPE__ -typedef __INT_LEAST32_TYPE__ __int_least32_t; -#ifdef __UINT_LEAST32_TYPE__ -typedef __UINT_LEAST32_TYPE__ __uint_least32_t; -#else -typedef unsigned __INT_LEAST32_TYPE__ __uint_least32_t; -#endif -#define ___int_least32_t_defined 1 -#elif defined(___int32_t_defined) typedef __int32_t __int_least32_t; typedef __uint32_t __uint_least32_t; -#define ___int_least32_t_defined 1 -#elif defined(___int64_t_defined) -typedef __int64_t __int_least32_t; -typedef __uint64_t __uint_least32_t; -#define ___int_least32_t_defined 1 -#endif +#define ___int_least32_t_defined -#ifdef __INT_LEAST64_TYPE__ -typedef __INT_LEAST64_TYPE__ __int_least64_t; -#ifdef __UINT_LEAST64_TYPE__ -typedef __UINT_LEAST64_TYPE__ __uint_least64_t; -#else -typedef unsigned __INT_LEAST64_TYPE__ __uint_least64_t; -#endif -#define ___int_least64_t_defined 1 -#elif defined(___int64_t_defined) typedef __int64_t __int_least64_t; typedef __uint64_t __uint_least64_t; -#define ___int_least64_t_defined 1 -#endif +#define ___int_least64_t_defined -#ifdef __INTPTR_TYPE__ typedef __INTPTR_TYPE__ __intptr_t; -#ifdef __UINTPTR_TYPE__ typedef __UINTPTR_TYPE__ __uintptr_t; -#else -typedef unsigned __INTPTR_TYPE__ __uintptr_t; -#endif -#elif defined(__PTRDIFF_TYPE__) -typedef __PTRDIFF_TYPE__ __intptr_t; -typedef unsigned __PTRDIFF_TYPE__ __uintptr_t; -#else -typedef long __intptr_t; -typedef unsigned long __uintptr_t; -#endif - -#undef __EXP #ifdef __cplusplus } diff --git a/libc/xtensa-lx106-elf/include/sys/_intsup.h b/libc/xtensa-lx106-elf/include/sys/_intsup.h index 7c3bc01..fa78426 100644 --- a/libc/xtensa-lx106-elf/include/sys/_intsup.h +++ b/libc/xtensa-lx106-elf/include/sys/_intsup.h @@ -4,6 +4,8 @@ * * Permission to use, copy, modify, and distribute this software * is freely granted, provided that this notice is preserved. + * + * Modified for xtensa arch & non-long int32_t, removes automatic setting of __have_long32. */ #ifndef _SYS__INTSUP_H @@ -11,26 +13,8 @@ #include -#if __GNUC_PREREQ (3, 2) -/* gcc > 3.2 implicitly defines the values we are interested */ #define __STDINT_EXP(x) __##x##__ -#else -#define __STDINT_EXP(x) x -#include -#endif -/* Check if "long long" is 64bit wide */ -/* Modern GCCs provide __LONG_LONG_MAX__, SUSv3 wants LLONG_MAX */ -#if ( defined(__LONG_LONG_MAX__) && (__LONG_LONG_MAX__ > 0x7fffffff) ) \ - || ( defined(LLONG_MAX) && (LLONG_MAX > 0x7fffffff) ) #define __have_longlong64 1 -#endif - -/* Check if "long" is 64bit or 32bit wide */ -#if __STDINT_EXP(LONG_MAX) > 0x7fffffff -#define __have_long64 1 -#elif __STDINT_EXP(LONG_MAX) == 0x7fffffff && !defined(__SPU__) -#define __have_long32 1 -#endif #endif /* _SYS__INTSUP_H */ diff --git a/libc/xtensa-lx106-elf/lib/libc.a b/libc/xtensa-lx106-elf/lib/libc.a index bf519fd..33cfced 100644 Binary files a/libc/xtensa-lx106-elf/lib/libc.a and b/libc/xtensa-lx106-elf/lib/libc.a differ diff --git a/libc/xtensa-lx106-elf/lib/libg.a b/libc/xtensa-lx106-elf/lib/libg.a index bf519fd..33cfced 100644 Binary files a/libc/xtensa-lx106-elf/lib/libg.a and b/libc/xtensa-lx106-elf/lib/libg.a differ diff --git a/libc/xtensa-lx106-elf/lib/libm.a b/libc/xtensa-lx106-elf/lib/libm.a index 8ec1b24..7a2455b 100644 Binary files a/libc/xtensa-lx106-elf/lib/libm.a and b/libc/xtensa-lx106-elf/lib/libm.a differ