Implement memory profiler, optimize memory usage, modify code indent (#35)
This commit is contained in:
@ -75,7 +75,7 @@ https://docs.zephyrproject.org/latest/getting_started/index.html</br>
|
||||
However, nucleo_f767zi is almost the same as nucleo_f746zg, except FLASH and SRAM size.
|
||||
So we changed the DTS setting of nucleo_f746zg boards for a workaround.</br>
|
||||
|
||||
`Modify zephyr/dts/arm/st/f7/stm32f746xg.dtsi, change DT_SIZE_K(320) to DT_SIZE_K(512)`</br>
|
||||
`Modify zephyr/dts/arm/st/f7/stm32f746Xg.dtsi, change DT_SIZE_K(320) to DT_SIZE_K(512)`</br>
|
||||
`mkdir build && cd build`</br>
|
||||
`source ../../../../zephyr-env.sh`</br>
|
||||
`cmake -GNinja -DBOARD=nucleo_f746zg ..`</br>
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -50,6 +50,6 @@ SRCS += ../../../core/iwasm/lib/app-libs/base/timer.c
|
||||
all:
|
||||
@$(CC) $(CFLAGS) $(SRCS) \
|
||||
-s WASM=1 -s SIDE_MODULE=1 -s ASSERTIONS=1 -s STACK_OVERFLOW_CHECK=2 \
|
||||
-s TOTAL_MEMORY=131072 -s TOTAL_STACK=8096 \
|
||||
-s TOTAL_MEMORY=65536 -s TOTAL_STACK=2048\
|
||||
-s "EXPORTED_FUNCTIONS=['_on_init', '_on_request', '_on_sensor_event', '_on_timer_callback']" \
|
||||
-o ui_app.wasm
|
||||
|
||||
Reference in New Issue
Block a user