I'm currently experimenting with bare metal programming for the esp32, for that reason I want to limit the esp-idf part to the bare minimum
I created the following application:
Code: Select all
#define MMIO32(addr) (*(volatile uint32_t *)(addr))
#define NO_CAL 1
void ENTRY_POIMT
{
// Disable RTC watchdog set by bootloader
MMIO32(0x3ff48000+0x8c) &= ~((uint32_t)(1<<10));
// Disable Timer0 watchdog set by bootloader
MMIO32(0x3ff5F000+0x0048) &= ~((uint32_t)(1<<14));
asm volatile("wsr %0, vecbase\n" :: "r"(&_init_start));
memset(&_bss_start, 0, (size_t)(&_bss_end - &_bss_start) * sizeof(_bss_start));
// BT clck enable
/* Mask for all Bluetooth clock bits - 0, 3, 6, 7, 8, 9, 11, 16, 17 */
MMIO32(0x3FF00000 + 0x0CC) |= ((uint32_t) (0x30BC9));
// BT reset
MMIO32(0x3FF00000 + 0x0D0) |= ~((uint32_t) (0));
esp_phy_calibration_data_t* cal_data = (esp_phy_calibration_data_t*) malloc(sizeof(esp_phy_calibration_data_t));
memset(cal_data, 0, sizeof(esp_phy_calibration_data_t ));
uart_string_tx("RF INIT !!!!\n");
register_chipv7_phy(NULL, cal_data, NO_CAL);
uart_string_tx("[DONE] RF INIT !!!!\n");
while(1);
But for some reason I never see the last print, The code seems to be stuck inside the phy init part. Did I forget to initialize something else? Note: my malloc implementation is tested and works.