mirror of
				https://github.com/esp8266/Arduino.git
				synced 2025-10-27 05:56:11 +03:00 
			
		
		
		
	Fix initialisation, fix HardwareSerial, add esptool.py flashing
This commit is contained in:
		| @@ -1,7 +1,7 @@ | |||||||
| ############################################################## | ############################################################## | ||||||
| esp01.name=ESP-01 | esp01.name=ESP-01 | ||||||
|  |  | ||||||
| esp01.upload.tool=esptool | esp01.upload.tool=esptoolpy | ||||||
| esp01.upload.speed=57600 | esp01.upload.speed=57600 | ||||||
| esp01.upload.wait_for_upload_port=true | esp01.upload.wait_for_upload_port=true | ||||||
|  |  | ||||||
|   | |||||||
| @@ -208,15 +208,25 @@ void serial_rx_handler(char c) | |||||||
| { | { | ||||||
|     Serial._rx_complete_irq(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) | void HardwareSerial::begin(unsigned long baud, byte config) | ||||||
| { | { | ||||||
|     _uart = uart0_init(baud, &serial_rx_handler); |     _uart = uart0_init(baud, &serial_rx_handler); | ||||||
|  |     _written = false; | ||||||
| } | } | ||||||
|  |  | ||||||
| void HardwareSerial::end() | void HardwareSerial::end() | ||||||
| { | { | ||||||
|     uart0_uninit(_uart); |     uart0_uninit(_uart); | ||||||
|  |     _uart = 0; | ||||||
| } | } | ||||||
|  |  | ||||||
| int HardwareSerial::available(void) | int HardwareSerial::available(void) | ||||||
| @@ -263,7 +273,7 @@ void HardwareSerial::flush() | |||||||
|  |  | ||||||
| size_t HardwareSerial::write(uint8_t c) | 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 |     // // If the buffer and the data register is empty, just write the byte | ||||||
|     // // to the data register and be done. This shortcut helps |     // // to the data register and be done. This shortcut helps | ||||||
|     // // significantly improve the effective datarate at high (> |     // // significantly improve the effective datarate at high (> | ||||||
| @@ -294,9 +304,9 @@ size_t HardwareSerial::write(uint8_t c) | |||||||
|     // _tx_buffer_head = i; |     // _tx_buffer_head = i; | ||||||
|      |      | ||||||
|     // sbi(*_ucsrb, UDRIE0); |     // sbi(*_ucsrb, UDRIE0); | ||||||
|     // _written = true; |     _written = true; | ||||||
|      |      | ||||||
|     // return 1; |     return 1; | ||||||
| } | } | ||||||
|  |  | ||||||
| void HardwareSerial::_rx_complete_irq(char c) | void HardwareSerial::_rx_complete_irq(char c) | ||||||
|   | |||||||
| @@ -80,7 +80,7 @@ class HardwareSerial : public Stream | |||||||
|     unsigned char _tx_buffer[SERIAL_TX_BUFFER_SIZE]; |     unsigned char _tx_buffer[SERIAL_TX_BUFFER_SIZE]; | ||||||
|  |  | ||||||
|   public: |   public: | ||||||
|     HardwareSerial() : _uart(0) { } |     HardwareSerial(); | ||||||
|  |  | ||||||
|     void begin(unsigned long baud) { begin(baud, 0); } |     void begin(unsigned long baud) { begin(baud, 0); } | ||||||
|     void begin(unsigned long, uint8_t); |     void begin(unsigned long, uint8_t); | ||||||
|   | |||||||
| @@ -114,7 +114,7 @@ void user_init(void) | |||||||
|                     g_loop_queue, |                     g_loop_queue, | ||||||
|                     LOOP_QUEUE_SIZE); |                     LOOP_QUEUE_SIZE); | ||||||
|  |  | ||||||
|     system_init_done_cb(&esp_schedule); |     system_init_done_cb(&init_done); | ||||||
| } | } | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -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.verbose= | ||||||
| tools.esptoolpy.program.params.quiet= | 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" | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user