1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-21 10:26:06 +03:00

Fix initialisation, fix HardwareSerial, add esptool.py flashing

This commit is contained in:
Ivan Grokhotkov 2014-11-25 09:58:14 +03:00
parent 66cac95b4b
commit 39e087a19e
5 changed files with 18 additions and 8 deletions

View File

@ -1,7 +1,7 @@
##############################################################
esp01.name=ESP-01
esp01.upload.tool=esptool
esp01.upload.tool=esptoolpy
esp01.upload.speed=57600
esp01.upload.wait_for_upload_port=true

View File

@ -208,15 +208,25 @@ void serial_rx_handler(char c)
{
Serial._rx_complete_irq(c);
}
extern "C" size_t ets_printf(const char*, ...);
HardwareSerial::HardwareSerial() :
_rx_buffer_head(0), _rx_buffer_tail(0),
_tx_buffer_head(0), _tx_buffer_tail(0),
_uart(0)
{
}
void HardwareSerial::begin(unsigned long baud, byte config)
{
_uart = uart0_init(baud, &serial_rx_handler);
_written = false;
}
void HardwareSerial::end()
{
uart0_uninit(_uart);
_uart = 0;
}
int HardwareSerial::available(void)
@ -263,7 +273,7 @@ void HardwareSerial::flush()
size_t HardwareSerial::write(uint8_t c)
{
WRITE_PERI_REG(UART_FIFO(0), c);
uart0_transmit_char(_uart, c);
// // If the buffer and the data register is empty, just write the byte
// // to the data register and be done. This shortcut helps
// // significantly improve the effective datarate at high (>
@ -294,9 +304,9 @@ size_t HardwareSerial::write(uint8_t c)
// _tx_buffer_head = i;
// sbi(*_ucsrb, UDRIE0);
// _written = true;
_written = true;
// return 1;
return 1;
}
void HardwareSerial::_rx_complete_irq(char c)

View File

@ -80,7 +80,7 @@ class HardwareSerial : public Stream
unsigned char _tx_buffer[SERIAL_TX_BUFFER_SIZE];
public:
HardwareSerial() : _uart(0) { }
HardwareSerial();
void begin(unsigned long baud) { begin(baud, 0); }
void begin(unsigned long, uint8_t);

View File

@ -114,7 +114,7 @@ void user_init(void)
g_loop_queue,
LOOP_QUEUE_SIZE);
system_init_done_cb(&esp_schedule);
system_init_done_cb(&init_done);
}
}

View File

@ -80,9 +80,9 @@ recipe.size.regex.eeprom=^(?:\.eeprom)\s+([0-9]+).*
# ------------------------------
tools.esptoolpy.cmd.path={runtime.ide.path}/hardware/tools/esptool.py
tools.esptoolpy.cmd.path={runtime.ide.path}/hardware/tools/esp8266/espflash
tools.esptoolpy.program.params.verbose=
tools.esptoolpy.program.params.quiet=
tools.esptoolpy.program.pattern="python {cmd.path}" --port={serial.port} write_flash 0x00000 "{build.path}/{build.project_name}._00000.bin"
tools.esptoolpy.program.pattern="{cmd.path}" --port={serial.port} write_flash 0x00000 "{build.path}/{build.project_name}_00000.bin" 0x40000 "{build.path}/{build.project_name}_40000.bin"