Implement memory profiler, optimize memory usage, modify code indent (#35)
This commit is contained in:
@ -342,7 +342,7 @@ static host_interface interface = { .send = uart_send, .destroy = uart_destroy }
|
||||
|
||||
#endif
|
||||
|
||||
static char global_heap_buf[1024 * 1024] = { 0 };
|
||||
static char global_heap_buf[270 * 1024] = { 0 };
|
||||
|
||||
static void showUsage()
|
||||
{
|
||||
|
||||
@ -152,7 +152,7 @@ void xpt2046_init(void)
|
||||
return;
|
||||
}
|
||||
gpio_pin_configure(xpt2046_cs_ctrl.gpio_dev, XPT2046_CS_GPIO_PIN,
|
||||
GPIO_DIR_OUT);
|
||||
GPIO_DIR_OUT);
|
||||
gpio_pin_write(xpt2046_cs_ctrl.gpio_dev, XPT2046_CS_GPIO_PIN, 1);
|
||||
xpt2046_cs_ctrl.gpio_pin = XPT2046_CS_GPIO_PIN;
|
||||
xpt2046_cs_ctrl.delay = 0;
|
||||
@ -169,14 +169,15 @@ void xpt2046_init(void)
|
||||
}
|
||||
/* Setup GPIO input */
|
||||
ret = gpio_pin_configure(xpt2046_pen_gpio_dev, XPT2046_PEN_GPIO_PIN,
|
||||
(GPIO_DIR_IN | GPIO_INT | GPIO_INT_EDGE | GPIO_INT_ACTIVE_LOW
|
||||
| GPIO_INT_DEBOUNCE));
|
||||
(GPIO_DIR_IN | GPIO_INT | GPIO_INT_EDGE
|
||||
| GPIO_INT_ACTIVE_LOW | GPIO_INT_DEBOUNCE)
|
||||
);
|
||||
if (ret) {
|
||||
printk("Error configuring pin %d!\n", XPT2046_PEN_GPIO_PIN);
|
||||
}
|
||||
|
||||
gpio_init_callback(&gpio_cb, xpt2046_pen_gpio_callback,
|
||||
BIT(XPT2046_PEN_GPIO_PIN));
|
||||
BIT(XPT2046_PEN_GPIO_PIN));
|
||||
|
||||
ret = gpio_add_callback(xpt2046_pen_gpio_dev, &gpio_cb);
|
||||
if (ret) {
|
||||
@ -191,10 +192,10 @@ void xpt2046_init(void)
|
||||
k_sem_init(&sem_touch_read, 0, 1);
|
||||
|
||||
k_thread_create(&touch_thread_data, touch_read_thread_stack,
|
||||
TOUCH_READ_THREAD_STACK_SIZE, touch_screen_read_thread, NULL, NULL, NULL, 5,
|
||||
0, K_NO_WAIT);
|
||||
TOUCH_READ_THREAD_STACK_SIZE, touch_screen_read_thread,
|
||||
NULL, NULL, NULL, 5,
|
||||
0, K_NO_WAIT);
|
||||
printf("xpt2046_init ok \n");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -43,7 +43,6 @@ static void uart_irq_callback(struct device *dev)
|
||||
int size = 0;
|
||||
|
||||
while (uart_poll_in(dev, &ch) == 0) {
|
||||
|
||||
uart_char_cnt++;
|
||||
aee_host_msg_callback(&ch, 1);
|
||||
}
|
||||
@ -66,24 +65,27 @@ static bool host_init()
|
||||
int host_send(void * ctx, const char *buf, int size)
|
||||
{
|
||||
for (int i = 0; i < size; i++)
|
||||
uart_poll_out(uart_dev, buf[i]);
|
||||
uart_poll_out(uart_dev, buf[i]);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
void host_destroy()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
host_interface interface = {
|
||||
.init = host_init,
|
||||
.send = host_send,
|
||||
.destroy = host_destroy
|
||||
};
|
||||
|
||||
#define DEFAULT_THREAD_STACKSIZE (8 * 1024)
|
||||
|
||||
host_interface interface = { .init = host_init, .send =
|
||||
host_send, .destroy = host_destroy };
|
||||
timer_ctx_t timer_ctx;
|
||||
static char global_heap_buf[ 498*1024] = { 0 };
|
||||
|
||||
static char global_heap_buf[270 * 1024] = { 0 };
|
||||
|
||||
extern void display_init(void);
|
||||
|
||||
int iwasm_main()
|
||||
{
|
||||
korp_thread tid, tm_tid;
|
||||
@ -108,6 +110,7 @@ int iwasm_main()
|
||||
// TODO:
|
||||
app_manager_startup(&interface);
|
||||
|
||||
fail1: bh_memory_destroy();
|
||||
fail1:
|
||||
bh_memory_destroy();
|
||||
return -1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user