Skip to content

Commit

Permalink
Initial esp-lisp as it was 2015-09-22 19:19
Browse files Browse the repository at this point in the history
- initial datatypes: string, atom, cons, int, prim
- primitive function apply - slow but generic
- lisp reader
- princ writer, terpri
- a version of lisp eval that only calls a primitive function
- some tests for reader/writer and primitive call
- ./run to compile and run on desktop and to compile for esp, run make flash to flush
- ./mcu to connect to chip
  • Loading branch information
yesco committed Sep 30, 2015
1 parent 8c84183 commit 29c3a73
Show file tree
Hide file tree
Showing 8 changed files with 517 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Makefile
@@ -0,0 +1,4 @@
# Simple makefile for eps-lisp
PROGRAM=*.c
include ../esp-open-rtos/common.mk

1 change: 1 addition & 0 deletions add-path
@@ -0,0 +1 @@
source ../path-add-esp
59 changes: 59 additions & 0 deletions esplisp.c
@@ -0,0 +1,59 @@
/* 2015-09-22 (C) Jonas S Karlsson, jsk@yesco.org */
/* "driver" for esp-open-rtos put in examples/lisp */

#include "espressif/esp_common.h"
#include "espressif/sdk_private.h"
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"

#include <string.h>

#include "lisp.h"

void task1(void *pvParameters)
{
xQueueHandle *queue = (xQueueHandle *)pvParameters;
printf("Hello from task1!\r\n");
uint32_t count = 0;
while(1) {
vTaskDelay(300); // 3s

unsigned int mem = xPortGetFreeHeapSize();
printf("free=%u\r\n", mem);
lisptest();
printf("free=%u USED=%u\r\n", xPortGetFreeHeapSize(), (unsigned int)(mem-xPortGetFreeHeapSize()));

xQueueSend(*queue, &count, 0);
count++;
}
}

void task2(void *pvParameters)
{
printf("Hello from task 2!\r\n");
xQueueHandle *queue = (xQueueHandle *)pvParameters;
while(1) {
uint32_t count;
if(xQueueReceive(*queue, &count, 1000)) {
//printf("Got %u\n", count);
putchar('.');
} else {
printf("No msg :(\n");
}
}
}

static xQueueHandle mainqueue;

void user_init(void)
{
sdk_uart_div_modify(0, UART_CLK_FREQ / 115200);
printf("SDK version:%s\n", sdk_system_get_sdk_version());

lispinit();

mainqueue = xQueueCreate(10, sizeof(uint32_t));
xTaskCreate(task1, (signed char *)"tsk1", 256, &mainqueue, 2, NULL);
xTaskCreate(task2, (signed char *)"tsk2", 256, &mainqueue, 2, NULL);
}

0 comments on commit 29c3a73

Please sign in to comment.