libc: Redefine int32_t/uint32_t as 'int' not 'long'
libc built from projectgus/newlib-xtensa@0077776963 Closes #42
This commit is contained in:
parent
5aa095298d
commit
e61e84ca7d
10 changed files with 18 additions and 186 deletions
|
@ -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);
|
counts = timer_freq_to_count(frc, freq, div);
|
||||||
if(counts == 0)
|
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();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ void bmp180_task(void *pvParameters)
|
||||||
bmp180_trigger_measurement(com_queue);
|
bmp180_trigger_measurement(com_queue);
|
||||||
break;
|
break;
|
||||||
case MY_EVT_BMP180:
|
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), \
|
(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 );
|
ev.bmp180_data.pressure/100, ev.bmp180_data.pressure%100 );
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -34,7 +34,7 @@ void buttonPollTask(void *pvParameters)
|
||||||
{
|
{
|
||||||
taskYIELD();
|
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);
|
vTaskDelay(200 / portTICK_RATE_MS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ void buttonIntTask(void *pvParameters)
|
||||||
xQueueReceive(*tsqueue, &button_ts, portMAX_DELAY);
|
xQueueReceive(*tsqueue, &button_ts, portMAX_DELAY);
|
||||||
button_ts *= portTICK_RATE_MS;
|
button_ts *= portTICK_RATE_MS;
|
||||||
if(last < button_ts-200) {
|
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;
|
last = button_ts;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,8 +20,8 @@ IRAM void dump_frc1_seq(void)
|
||||||
uint32_t f1_a = TIMER(0).COUNT;
|
uint32_t f1_a = TIMER(0).COUNT;
|
||||||
uint32_t f1_b = TIMER(0).COUNT;
|
uint32_t f1_b = TIMER(0).COUNT;
|
||||||
uint32_t f1_c = 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 sequence 0x%08x 0x%08x 0x%08x\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 deltas %d %d \r\n", f1_b-f1_a, f1_c-f1_b);
|
||||||
}
|
}
|
||||||
|
|
||||||
IRAM void dump_frc2_seq(void)
|
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_a = TIMER(1).COUNT;
|
||||||
uint32_t f2_b = TIMER(1).COUNT;
|
uint32_t f2_b = TIMER(1).COUNT;
|
||||||
uint32_t f2_c = 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 sequence 0x%08x 0x%08x 0x%08x\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 deltas %d %d \r\n", f2_b-f2_a, f2_c-f2_b);
|
||||||
}
|
}
|
||||||
|
|
||||||
IRAM void dump_timer_regs(const char *msg)
|
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++) {
|
for(int i = 0; i < DUMP_SZ; i++) {
|
||||||
if(i % 4 == 0)
|
if(i % 4 == 0)
|
||||||
printf("%s0x%02x: ", i ? "\r\n" : "", i*4);
|
printf("%s0x%02x: ", i ? "\r\n" : "", i*4);
|
||||||
printf("%08lx ", chunk[i]);
|
printf("%08x ", chunk[i]);
|
||||||
}
|
}
|
||||||
printf("\r\n");
|
printf("\r\n");
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ static volatile uint32_t frc1_last_count_val;
|
||||||
void timerRegTask(void *pvParameters)
|
void timerRegTask(void *pvParameters)
|
||||||
{
|
{
|
||||||
while(1) {
|
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("");
|
dump_timer_regs("");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -87,10 +87,10 @@ void timerRegTask(void *pvParameters)
|
||||||
printf("INUM_MAX count %d\r\n", max_count);
|
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);
|
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);
|
frc2_last_count_val);
|
||||||
|
|
||||||
vTaskDelay(500 / portTICK_RATE_MS);
|
vTaskDelay(500 / portTICK_RATE_MS);
|
||||||
|
|
|
@ -26,7 +26,7 @@ void user_init(void)
|
||||||
|
|
||||||
printf("Image addresses in flash:\r\n");
|
printf("Image addresses in flash:\r\n");
|
||||||
for(int i = 0; i <conf.count; i++) {
|
for(int i = 0; i <conf.count; i++) {
|
||||||
printf("%c%d: offset 0x%08lx\r\n", i == conf.current_rom ? '*':' ', i, conf.roms[i]);
|
printf("%c%d: offset 0x%08x\r\n", i == conf.current_rom ? '*':' ', i, conf.roms[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct sdk_station_config config = {
|
struct sdk_station_config config = {
|
||||||
|
|
|
@ -25,7 +25,7 @@ void task2(void *pvParameters)
|
||||||
while(1) {
|
while(1) {
|
||||||
uint32_t count;
|
uint32_t count;
|
||||||
if(xQueueReceive(*queue, &count, 1000)) {
|
if(xQueueReceive(*queue, &count, 1000)) {
|
||||||
printf("Got %lu\n", count);
|
printf("Got %u\n", count);
|
||||||
} else {
|
} else {
|
||||||
printf("No msg :(\n");
|
printf("No msg :(\n");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
/*
|
/*
|
||||||
* $Id$
|
* _default_types implementation for xtensa lx106 arch
|
||||||
|
*
|
||||||
|
* Simplified version of generic _default_types.h, ignores gcc
|
||||||
|
* built-in standard types.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _MACHINE__DEFAULT_TYPES_H
|
#ifndef _MACHINE__DEFAULT_TYPES_H
|
||||||
|
@ -7,211 +10,40 @@
|
||||||
|
|
||||||
#include <sys/features.h>
|
#include <sys/features.h>
|
||||||
|
|
||||||
/*
|
|
||||||
* Guess on types by examining *_MIN / *_MAX defines.
|
|
||||||
*/
|
|
||||||
#if __GNUC_PREREQ (3, 3)
|
|
||||||
/* GCC >= 3.3.0 has __<val>__ implicitly defined. */
|
|
||||||
#define __EXP(x) __##x##__
|
|
||||||
#else
|
|
||||||
/* Fall back to POSIX versions from <limits.h> */
|
|
||||||
#define __EXP(x) x
|
|
||||||
#include <limits.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#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 signed char __int8_t ;
|
||||||
typedef unsigned char __uint8_t ;
|
typedef unsigned char __uint8_t ;
|
||||||
#define ___int8_t_defined 1
|
#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 signed short __int16_t;
|
||||||
typedef unsigned short __uint16_t;
|
typedef unsigned short __uint16_t;
|
||||||
#define ___int16_t_defined 1
|
#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 signed int __int32_t;
|
||||||
typedef unsigned int __uint32_t;
|
typedef unsigned int __uint32_t;
|
||||||
#define ___int32_t_defined 1
|
#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 signed long long __int64_t;
|
||||||
typedef unsigned long long __uint64_t;
|
typedef unsigned long long __uint64_t;
|
||||||
#define ___int64_t_defined 1
|
#define ___int64_t_defined 1
|
||||||
|
|
||||||
/* POSIX mandates LLONG_MAX in <limits.h> */
|
|
||||||
#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 __int8_t __int_least8_t;
|
||||||
typedef __uint8_t __uint_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
|
|
||||||
|
|
||||||
#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 __int16_t __int_least16_t;
|
||||||
typedef __uint16_t __uint_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
|
|
||||||
|
|
||||||
#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 __int32_t __int_least32_t;
|
||||||
typedef __uint32_t __uint_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
|
|
||||||
|
|
||||||
#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 __int64_t __int_least64_t;
|
||||||
typedef __uint64_t __uint_least64_t;
|
typedef __uint64_t __uint_least64_t;
|
||||||
#define ___int_least64_t_defined 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __INTPTR_TYPE__
|
|
||||||
typedef __INTPTR_TYPE__ __intptr_t;
|
typedef __INTPTR_TYPE__ __intptr_t;
|
||||||
#ifdef __UINTPTR_TYPE__
|
|
||||||
typedef __UINTPTR_TYPE__ __uintptr_t;
|
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
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in a new issue