Programming NodeMCU without arduino libraries

Hello, I want to do some bare metal programming (I know the SDK is proprietary but as close as i can get) on an esp8266 (nodeMCU) but the arduino IDE keeps linking the arduino core libraries with my code with leads to linker errors because of multiple definitions. Is there anyway for me to control the linking and compilation process on the IDE?
Here is a simple blink sketch I want to compile

extern "C" {
  #include <osapi.h>
  #include <eagle_soc.h>
  #include <user_interface.h>
}

os_timer_t blinking_led_timer;

extern "C" void ICACHE_FLASH_ATTR blink_led(void *arg)
{
  if (GPIO_REG_READ(GPIO_IN_ADDRESS) & BIT2) {
    GPIO_REG_WRITE(GPIO_OUT_W1TC_ADDRESS, BIT2);
  } else {
    GPIO_REG_WRITE(GPIO_OUT_W1TS_ADDRESS, BIT2);
  }
}

extern "C" void on_system_init_done()
{
  // configure IO2 as output
  GPIO_REG_WRITE(GPIO_ENABLE_W1TS_ADDRESS, BIT2);

  os_timer_setfn(&blinking_led_timer, blink_led, NULL);
  os_timer_arm(&blinking_led_timer, 500, 1); // 500ms, repeating
}

extern "C" void user_init(void)
{
  uart_div_modify(0, UART_CLK_FREQ / 921600);
  system_init_done_cb(on_system_init_done);
}

Since core_esp8266_main.cpp already defines user_init the linker throws an error.

try https://platformio.org

idk if it will work if you just not specify Arduino framework in the config -> but, even if you do specify it, you can override what is being compiled/flashed anyway: Advanced Scripting — PlatformIO latest documentation

Moved to Project Guidance..... Wasn't related to the development of Arduino libraries.

Yes that would work thank you. Although I am using a school chromebook so I won't be able to install it on here. I'll ask the IT department at my school to enable Linux on my chromebook or I'll use one of the school windows computers.

isn't chromebook just a linux with some custom google UI?

because you don't really need the PlatformIO IDE (which actually is just a plugin for Visual Studio Code), but you can simply use command line interface to to do everything

https://docs.platformio.org/en/stable/core/index.html

The school chromebook is locked down and has a lot of restrictions. It is essentially a glorified bootloader for google chrome anything else is blocked. I can't install anything. Arduino Create has a web version which I have been using on the chromebook.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.