Skip to content

Fix RAM corruption caused by our hook of register_chipv6_phy(init_data*) #1277

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 22, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions cores/esp8266/core_esp8266_phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
#include <stddef.h>
#include <stdbool.h>

static uint8_t phy_init_data[128] =
#include "c_types.h"

static const uint8_t ICACHE_FLASH_ATTR phy_init_data[128] =
{
[0] = 5, // Reserved, do not change
[1] = 0, // Reserved, do not change
Expand Down Expand Up @@ -241,9 +243,12 @@ static uint8_t phy_init_data[128] =
};

extern int __real_register_chipv6_phy(uint8_t* init_data);
extern int __wrap_register_chipv6_phy(uint8_t* unused) {
phy_init_data[107] = __get_adc_mode();
return __real_register_chipv6_phy(phy_init_data);
extern int __wrap_register_chipv6_phy(uint8_t* init_data) {
if (init_data != NULL) {
memcpy(init_data, phy_init_data, sizeof(phy_init_data));
init_data[107] = __get_adc_mode();
}
return __real_register_chipv6_phy(init_data);
}

extern int __get_rf_mode(void) __attribute__((weak));
Expand Down