Code compiles and uploads successfully, but refuses to run on ESP32

Hi everyone,
I’m trying to use the esp-mdf library from espressif which is based on ESP-IDF in arduino, so I decided to copy the source and header files of that project in my platformIO project’s src/ folder. Then I added these definitions from the original sdkconfig into the sdkconfig.h of the project

#define CONFIG_MDF_TASK_DEFAULT_PRIOTY 1
#define CONFIG_MDF_TASK_PINNED_TO_CORE 0
#define CONFIG_MDF_EVENT_TASK_STACK_SIZE 4096
#define CONFIG_MDF_MEM_ALLOCATION_DEFAULT
#define CONFIG_MDF_MEM_DEBUG
#define CONFIG_MDF_MEM_DBG_INFO_MAX 128
#define CONFIG_MDF_ERR_TO_NAME_LOOKUP
#define CONFIG_MDF_LOG_LEVEL_VERBOSE
#define CONFIG_MDF_LOG_LEVEL 5
//# end of MDF Mcommon
//#
//# MDF Mconfig
//#
#define CONFIG_MCONFIG_WHITELIST_ENABLE
#define CONFIG_MCONFIG_CHAIN_LMK “lmk1234567890123”
#define CONFIG_MCONFIG_CUSTOM_EXTERN_LEN 0
#define CONFIG_MCONFIG_VERIFY_ROUTER 1
#define CONFIG_MDEBUG_LOG_PARTITION_LABEL “reserved”
#define CONFIG_MDEBUG_LOG_PARTITION_OFFSET 0
#define CONFIG_MDEBUG_LOG_PACKET_MAX_SIZE 1188
#define CONFIG_MDEBUG_LOG_FILE_MAX_SIZE 32768
//#
//# MDF Mespnow
//#
#define CONFIG_MESPNOW_RETRANSMIT_NUM 3
#define CONFIG_MESPNOW_DEFAULT_PMK “pmk1234567890123”
#define CONFIG_MESPNOW_LOG_LEVEL 2
//#
//# Mespnow queue size
//#
#define CONFIG_MESPNOW_TRANS_PIPE_DEBUG_QUEUE_SIZE 5
#define CONFIG_MESPNOW_TRANS_PIPE_CONTROL_QUEUE_SIZE 5
#define CONFIG_MESPNOW_TRANS_PIPE_MCONFIG_QUEUE_SIZE 10
#define CONFIG_MESPNOW_TRANS_PIPE_RESERVED_QUEUE_SIZE 5
#define CONFIG_MUPGRADE_RETRY_COUNT 20
#define CONFIG_MUPGRADE_FLOW_CONTROL_LEVEL 5
#define CONFIG_MUPGRADE_WAIT_RESPONSE_TIMEOUT 3000
#define CONFIG_MUPGRADE_STATUS_REPORT_INTERVAL 10
#define CONFIG_MUPGRADE_VERSION_FALLBACK_RESTART
#define CONFIG_MUPGRADE_RESTART_COUNT 15
#define CONFIG_MUPGRADE_RESTART_TIMEOUT 5000
#define CONFIG_MUPGRADE_VERSION_FALLBACK_FACTORY
#define CONFIG_MWIFI_VOTE_PERCENTAGE 90
#define CONFIG_MWIFI_VOTE_MAX_COUNT 15
#define CONFIG_MWIFI_BACKOFF_RSSI -78
#define CONFIG_MWIFI_SCAN_MINI_COUNT 10
#define CONFIG_MWIFI_ROOT_HEALING_MS 6000
//# CONFIG_MWIFI_ROOT_CONFLICTS_ENABLE is not set
//# end of Root config
//#
//# Capacity config
//#
#define CONFIG_MWIFI_CAPACITY_NUM 512
#define CONFIG_MESH_TOPO_TREE
//# CONFIG_MESH_TOPO_CHAIN is not set
#define CONFIG_MWIFI_TOPOLOGY 0
#define CONFIG_MWIFI_MAX_LAYER 16
#define CONFIG_MWIFI_MAX_CONNECTION 6
//# end of Capacity config
//#
//# Stability config
//#
#define CONFIG_MWIFI_ASSOC_EXPIRE_MS 30000
#define CONFIG_MWIFI_BEACON_INTERVAL_MS 100
#define CONFIG_MWIFI_PASSIVE_SCAN_MS 300
#define CONFIG_MWIFI_MONITOR_DURATION_MS 60000
#define CONFIG_MWIFI_CNX_RSSI -120
#define CONFIG_MWIFI_SELECT_RSSI -78
#define CONFIG_MWIFI_SWITCH_RSSI -78
#define CONFIG_MWIFI_ATTEMPT_COUNT 60
#define CONFIG_MWIFI_MONITOR_IE_COUNT 10
#define CONFIG_MWIFI_WAIVE_ROOT
#define CONFIG_MWIFI_WAIVE_ROOT_RSSI -70
#define CONFIG_MWIFI_RSSI_THRESHOUD_HIGH -78
#define CONFIG_MWIFI_RSSI_THRESHOUD_MEDIUM -82
#define CONFIG_MWIFI_RSSI_THRESHOUD_LOW -85
//# end of Stability config
//#
//# Transmission config
//#
#define CONFIG_MWIFI_XON_QSIZE 32
#define CONFIG_MWIFI_RETRANSMIT_ENABLE
#define CONFIG_MWIFI_DATA_DROP_ENABLE
#define CONFIG_MWIFI_MESH_IE_ENABLE

And I also added a few flags in the platformio.ini file to resolve the include paths:

[env:esp32dev]
platform = espressif32
board = esp32dev
board_build.f_cpu = 160000000L
framework = arduino
monitor_speed = 115200
build_flags = -DCORE_DEBUG_LEVEL=5 -DDEBUG_ESP_PORT=Serial -DLOG_LOCAL_LEVEL=ESP_LOG_DEBUG
-I src/src/components/mcommon/include
-I src/src/components/mconfig/include
-I src/src/components/mdebug/include
-I src/src/components/mesh_lite/include
-I src/src/components/mespnow/include
-I src/src/components/mlink/include
-I src/src/components/mupgrade/include
-I src/src/components/mwifi/include
-I src/src/components/third_party/miniz/include

Now the code successfully compiles, but doesn’t run! This is all I see in the serial monitor

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:1184
load:0x40078000,len:13192
load:0x40080400,len:3028
entry 0x400805e4

This happens regardless of whether I put some code in setup() and loop() functions or not. I haven’t even included the library in the main.c file. It seems like the code is not booting in the first place. I added this two lines to the setup() function that should turn on the D2 pin, but nothing happens

void setup() {
// put your setup code here, to run once:
gpio_set_direction(GPIO_NUM_2, GPIO_MODE_OUTPUT);
gpio_set_level(GPIO_NUM_2, 1);
}

I don’t know why my extra files completely cripple the code to the point of not booting (I suspect one of the #defines is screwing up with arduino), and the serial monitor doesn’t help at all and I don’t own a JTAG. I’m completely at my wit’s end on how to debug this issue.

Can anyone help me debug and resolve this issue? Thanks a lot. I have also copied the entire project to this git repo: GitHub - clownfair/ESP_MDF_PlatformIO