annotate service/iot2/esp32_main/start_nim/main.c @ 1673:80f4e741ca4f

redo RHS bnode processing
author drewp@bigasterisk.com
date Wed, 22 Sep 2021 01:00:32 -0700
parents 17ff9322328b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
728
17ff9322328b an attempt as ESP-IDF build (doesn't work) calling a nim-generated main function (also doesn't work)
drewp@bigasterisk.com
parents:
diff changeset
1 #include <stdio.h>
17ff9322328b an attempt as ESP-IDF build (doesn't work) calling a nim-generated main function (also doesn't work)
drewp@bigasterisk.com
parents:
diff changeset
2 #include "sdkconfig.h"
17ff9322328b an attempt as ESP-IDF build (doesn't work) calling a nim-generated main function (also doesn't work)
drewp@bigasterisk.com
parents:
diff changeset
3 #include "freertos/FreeRTOS.h"
17ff9322328b an attempt as ESP-IDF build (doesn't work) calling a nim-generated main function (also doesn't work)
drewp@bigasterisk.com
parents:
diff changeset
4 #include "freertos/task.h"
17ff9322328b an attempt as ESP-IDF build (doesn't work) calling a nim-generated main function (also doesn't work)
drewp@bigasterisk.com
parents:
diff changeset
5 #include "esp_system.h"
17ff9322328b an attempt as ESP-IDF build (doesn't work) calling a nim-generated main function (also doesn't work)
drewp@bigasterisk.com
parents:
diff changeset
6 #include "esp_spi_flash.h"
17ff9322328b an attempt as ESP-IDF build (doesn't work) calling a nim-generated main function (also doesn't work)
drewp@bigasterisk.com
parents:
diff changeset
7
17ff9322328b an attempt as ESP-IDF build (doesn't work) calling a nim-generated main function (also doesn't work)
drewp@bigasterisk.com
parents:
diff changeset
8 extern void NimMain();
17ff9322328b an attempt as ESP-IDF build (doesn't work) calling a nim-generated main function (also doesn't work)
drewp@bigasterisk.com
parents:
diff changeset
9
17ff9322328b an attempt as ESP-IDF build (doesn't work) calling a nim-generated main function (also doesn't work)
drewp@bigasterisk.com
parents:
diff changeset
10 void app_main(void)
17ff9322328b an attempt as ESP-IDF build (doesn't work) calling a nim-generated main function (also doesn't work)
drewp@bigasterisk.com
parents:
diff changeset
11 {
17ff9322328b an attempt as ESP-IDF build (doesn't work) calling a nim-generated main function (also doesn't work)
drewp@bigasterisk.com
parents:
diff changeset
12 printf("Hello world!\n");
17ff9322328b an attempt as ESP-IDF build (doesn't work) calling a nim-generated main function (also doesn't work)
drewp@bigasterisk.com
parents:
diff changeset
13
17ff9322328b an attempt as ESP-IDF build (doesn't work) calling a nim-generated main function (also doesn't work)
drewp@bigasterisk.com
parents:
diff changeset
14 /* Print chip information */
17ff9322328b an attempt as ESP-IDF build (doesn't work) calling a nim-generated main function (also doesn't work)
drewp@bigasterisk.com
parents:
diff changeset
15 esp_chip_info_t chip_info;
17ff9322328b an attempt as ESP-IDF build (doesn't work) calling a nim-generated main function (also doesn't work)
drewp@bigasterisk.com
parents:
diff changeset
16 esp_chip_info(&chip_info);
17ff9322328b an attempt as ESP-IDF build (doesn't work) calling a nim-generated main function (also doesn't work)
drewp@bigasterisk.com
parents:
diff changeset
17 printf("This is %s chip with %d CPU cores, WiFi%s%s, ",
17ff9322328b an attempt as ESP-IDF build (doesn't work) calling a nim-generated main function (also doesn't work)
drewp@bigasterisk.com
parents:
diff changeset
18 CONFIG_IDF_TARGET,
17ff9322328b an attempt as ESP-IDF build (doesn't work) calling a nim-generated main function (also doesn't work)
drewp@bigasterisk.com
parents:
diff changeset
19 chip_info.cores,
17ff9322328b an attempt as ESP-IDF build (doesn't work) calling a nim-generated main function (also doesn't work)
drewp@bigasterisk.com
parents:
diff changeset
20 (chip_info.features & CHIP_FEATURE_BT) ? "/BT" : "",
17ff9322328b an attempt as ESP-IDF build (doesn't work) calling a nim-generated main function (also doesn't work)
drewp@bigasterisk.com
parents:
diff changeset
21 (chip_info.features & CHIP_FEATURE_BLE) ? "/BLE" : "");
17ff9322328b an attempt as ESP-IDF build (doesn't work) calling a nim-generated main function (also doesn't work)
drewp@bigasterisk.com
parents:
diff changeset
22
17ff9322328b an attempt as ESP-IDF build (doesn't work) calling a nim-generated main function (also doesn't work)
drewp@bigasterisk.com
parents:
diff changeset
23 printf("silicon revision %d, ", chip_info.revision);
17ff9322328b an attempt as ESP-IDF build (doesn't work) calling a nim-generated main function (also doesn't work)
drewp@bigasterisk.com
parents:
diff changeset
24
17ff9322328b an attempt as ESP-IDF build (doesn't work) calling a nim-generated main function (also doesn't work)
drewp@bigasterisk.com
parents:
diff changeset
25 printf("%dMB %s flash\n", spi_flash_get_chip_size() / (1024 * 1024),
17ff9322328b an attempt as ESP-IDF build (doesn't work) calling a nim-generated main function (also doesn't work)
drewp@bigasterisk.com
parents:
diff changeset
26 (chip_info.features & CHIP_FEATURE_EMB_FLASH) ? "embedded" : "external");
17ff9322328b an attempt as ESP-IDF build (doesn't work) calling a nim-generated main function (also doesn't work)
drewp@bigasterisk.com
parents:
diff changeset
27
17ff9322328b an attempt as ESP-IDF build (doesn't work) calling a nim-generated main function (also doesn't work)
drewp@bigasterisk.com
parents:
diff changeset
28
17ff9322328b an attempt as ESP-IDF build (doesn't work) calling a nim-generated main function (also doesn't work)
drewp@bigasterisk.com
parents:
diff changeset
29 printf("now nimmain, etc\n");
17ff9322328b an attempt as ESP-IDF build (doesn't work) calling a nim-generated main function (also doesn't work)
drewp@bigasterisk.com
parents:
diff changeset
30 fflush(stdout);
17ff9322328b an attempt as ESP-IDF build (doesn't work) calling a nim-generated main function (also doesn't work)
drewp@bigasterisk.com
parents:
diff changeset
31
17ff9322328b an attempt as ESP-IDF build (doesn't work) calling a nim-generated main function (also doesn't work)
drewp@bigasterisk.com
parents:
diff changeset
32 NimMain();
17ff9322328b an attempt as ESP-IDF build (doesn't work) calling a nim-generated main function (also doesn't work)
drewp@bigasterisk.com
parents:
diff changeset
33 }