minimacplus/components/tme-esp32/main.c
2017-03-24 18:44:04 +08:00

57 lines
1.2 KiB
C

#include "esp_attr.h"
#include "rom/cache.h"
#include "rom/ets_sys.h"
#include "rom/spi_flash.h"
#include "rom/crc.h"
#include "soc/soc.h"
#include "soc/dport_reg.h"
#include "soc/io_mux_reg.h"
#include "soc/efuse_reg.h"
#include "soc/rtc_cntl_reg.h"
#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include <stdlib.h>
#include "esp_err.h"
#include "nvs_flash.h"
#include "esp_partition.h"
#include "emu.h"
#include "tmeconfig.h"
#include "mpu6050.h"
unsigned char *romdata;
void emuTask(void *pvParameters)
{
void *ram=malloc(TME_RAMSIZE);
if (ram==NULL) {
printf("Couldn't allocate main ram.\n");
abort();
}
tmeStartEmu(ram, romdata);
}
void app_main()
{
int i;
const esp_partition_t* part;
spi_flash_mmap_handle_t hrom;
esp_err_t err;
// mpu6050_init();
// while(1);
part=esp_partition_find_first(0x40, 0x1, NULL);
if (part==0) printf("Couldn't find bootrom part!\n");
err=esp_partition_mmap(part, 0, 128*1024, SPI_FLASH_MMAP_DATA, (const void**)&romdata, &hrom);
if (err!=ESP_OK) printf("Couldn't map bootrom part!\n");
printf("Starting emu...\n");
xTaskCreatePinnedToCore(&emuTask, "emu", 6*1024, NULL, 5, NULL, 0);
}