Remove debug prints
This commit is contained in:
parent
08749630a2
commit
7f6bef3251
@ -39,11 +39,6 @@
|
||||
|
||||
#include "esp-idf/components/spi_flash/include/esp_partition.h"
|
||||
|
||||
#include "esp_log.h"
|
||||
|
||||
|
||||
static const char* TAG = "CircuitPython Internal Flash";
|
||||
|
||||
#include "supervisor/usb.h"
|
||||
|
||||
STATIC const esp_partition_t * _partition;
|
||||
@ -52,8 +47,6 @@ void supervisor_flash_init(void) {
|
||||
_partition = esp_partition_find_first(ESP_PARTITION_TYPE_DATA,
|
||||
ESP_PARTITION_SUBTYPE_DATA_FAT,
|
||||
NULL);
|
||||
|
||||
ESP_EARLY_LOGW(TAG, "fatfs partition %p", _partition);
|
||||
}
|
||||
|
||||
uint32_t supervisor_flash_get_block_size(void) {
|
||||
@ -74,11 +67,10 @@ STATIC uint8_t _cache[SECTOR_SIZE];
|
||||
STATIC uint32_t _cache_lba;
|
||||
|
||||
mp_uint_t supervisor_flash_read_blocks(uint8_t *dest, uint32_t block, uint32_t num_blocks) {
|
||||
esp_err_t ok = esp_partition_read(_partition,
|
||||
block * FILESYSTEM_BLOCK_SIZE,
|
||||
dest,
|
||||
num_blocks * FILESYSTEM_BLOCK_SIZE);
|
||||
ESP_EARLY_LOGW(TAG, "read %d", ok);
|
||||
esp_partition_read(_partition,
|
||||
block * FILESYSTEM_BLOCK_SIZE,
|
||||
dest,
|
||||
num_blocks * FILESYSTEM_BLOCK_SIZE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -90,13 +82,11 @@ mp_uint_t supervisor_flash_write_blocks(const uint8_t *src, uint32_t lba, uint32
|
||||
uint32_t sector_offset = block_address / blocks_per_sector * SECTOR_SIZE;
|
||||
uint8_t block_offset = block_address % blocks_per_sector;
|
||||
|
||||
esp_err_t result;
|
||||
if (_cache_lba != block_address) {
|
||||
result = esp_partition_read(_partition,
|
||||
sector_offset,
|
||||
_cache,
|
||||
SECTOR_SIZE);
|
||||
ESP_EARLY_LOGW(TAG, "flash read before write %d", result);
|
||||
esp_partition_read(_partition,
|
||||
sector_offset,
|
||||
_cache,
|
||||
SECTOR_SIZE);
|
||||
_cache_lba = sector_offset;
|
||||
}
|
||||
for (uint8_t b = block_offset; b < blocks_per_sector; b++) {
|
||||
@ -109,11 +99,11 @@ mp_uint_t supervisor_flash_write_blocks(const uint8_t *src, uint32_t lba, uint32
|
||||
FILESYSTEM_BLOCK_SIZE);
|
||||
block++;
|
||||
}
|
||||
result = esp_partition_erase_range(_partition, sector_offset, SECTOR_SIZE);
|
||||
result = esp_partition_write(_partition,
|
||||
sector_offset,
|
||||
_cache,
|
||||
SECTOR_SIZE);
|
||||
esp_partition_erase_range(_partition, sector_offset, SECTOR_SIZE);
|
||||
esp_partition_write(_partition,
|
||||
sector_offset,
|
||||
_cache,
|
||||
SECTOR_SIZE);
|
||||
}
|
||||
|
||||
return 0; // success
|
||||
|
@ -41,10 +41,6 @@
|
||||
#include "supervisor/memory.h"
|
||||
#include "supervisor/shared/tick.h"
|
||||
|
||||
#include "esp_log.h"
|
||||
|
||||
static const char* TAG = "CircuitPython";
|
||||
|
||||
STATIC esp_timer_handle_t _tick_timer;
|
||||
|
||||
void tick_timer_cb(void* arg) {
|
||||
@ -57,12 +53,8 @@ safe_mode_t port_init(void) {
|
||||
args.arg = NULL;
|
||||
args.dispatch_method = ESP_TIMER_TASK;
|
||||
args.name = "CircuitPython Tick";
|
||||
esp_err_t result = esp_timer_create(&args, &_tick_timer);
|
||||
if (result != ESP_OK) {
|
||||
ESP_EARLY_LOGE(TAG, "Unable to create tick timer.");
|
||||
}
|
||||
esp_timer_create(&args, &_tick_timer);
|
||||
never_reset_module_internal_pins();
|
||||
ESP_EARLY_LOGW(TAG, "port init done");
|
||||
return NO_SAFE_MODE;
|
||||
}
|
||||
|
||||
@ -109,12 +101,8 @@ uint32_t *port_stack_get_top(void) {
|
||||
supervisor_allocation _fixed_stack;
|
||||
|
||||
supervisor_allocation* port_fixed_stack(void) {
|
||||
|
||||
ESP_EARLY_LOGW(TAG, "port fixed stack");
|
||||
_fixed_stack.ptr = port_stack_get_limit();
|
||||
ESP_EARLY_LOGW(TAG, "got limit %p", _fixed_stack.ptr);
|
||||
_fixed_stack.length = (port_stack_get_top() - port_stack_get_limit()) * sizeof(uint32_t);
|
||||
ESP_EARLY_LOGW(TAG, "got length %d", _fixed_stack.length);
|
||||
return &_fixed_stack;
|
||||
}
|
||||
|
||||
@ -139,10 +127,7 @@ uint64_t port_get_raw_ticks(uint8_t* subticks) {
|
||||
|
||||
// Enable 1/1024 second tick.
|
||||
void port_enable_tick(void) {
|
||||
esp_err_t result = esp_timer_start_periodic(_tick_timer, 1000000 / 1024);
|
||||
if (result != ESP_OK) {
|
||||
ESP_EARLY_LOGE(TAG, "Unable to start tick timer.");
|
||||
}
|
||||
esp_timer_start_periodic(_tick_timer, 1000000 / 1024);
|
||||
}
|
||||
|
||||
// Disable 1/1024 second tick.
|
||||
@ -153,14 +138,12 @@ void port_disable_tick(void) {
|
||||
TickType_t sleep_time_set;
|
||||
TickType_t sleep_time_duration;
|
||||
void port_interrupt_after_ticks(uint32_t ticks) {
|
||||
// ESP_EARLY_LOGW(TAG, "after ticks");
|
||||
sleep_time_set = xTaskGetTickCount();
|
||||
sleep_time_duration = ticks / portTICK_PERIOD_MS;
|
||||
// esp_sleep_enable_timer_wakeup(uint64_t time_in_us)
|
||||
}
|
||||
|
||||
void port_sleep_until_interrupt(void) {
|
||||
// ESP_EARLY_LOGW(TAG, "sleep until");
|
||||
// FreeRTOS delay here maybe.
|
||||
// Light sleep shuts down BLE and wifi.
|
||||
// esp_light_sleep_start()
|
||||
@ -174,8 +157,5 @@ void port_sleep_until_interrupt(void) {
|
||||
// Wrap main in app_main that the IDF expects.
|
||||
extern void main(void);
|
||||
void app_main(void) {
|
||||
ESP_EARLY_LOGW(TAG, "Hello from CircuitPython");
|
||||
// ESP_LOGW(TAG, "Hello from CircuitPython");
|
||||
|
||||
main();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user