File tree Expand file tree Collapse file tree 5 files changed +47
-10
lines changed
Expand file tree Collapse file tree 5 files changed +47
-10
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ extern "C" {
1717 *
1818 * @param us Number of microseconds to delay.
1919 */
20- void esp_stub_lib_delay_us (uint32_t us );
20+ void stub_lib_delay_us (uint32_t us );
2121
2222/**
2323 * @brief Compute little-endian CRC16 over a byte buffer.
@@ -27,27 +27,27 @@ void esp_stub_lib_delay_us(uint32_t us);
2727 * @param len Number of bytes to process.
2828 * @return Updated CRC16 value.
2929 */
30- uint16_t esp_stub_lib_crc16_le (uint16_t crc , const uint8_t * buf , uint32_t len );
30+ uint16_t stub_lib_crc16_le (uint16_t crc , const uint8_t * buf , uint32_t len );
3131
3232/**
3333 * @brief Transmit a single byte over UART.
3434 *
3535 * @param c Byte to transmit.
3636 * @return 0 if successful, non-zero if error occurred.
3737 */
38- uint8_t esp_stub_lib_tx_one_char (uint8_t c );
38+ uint8_t stub_lib_uart_tx_one_char (uint8_t c );
3939
4040/**
4141 * @brief Receive a single byte (blocking) from UART.
4242 *
4343 * @return Received byte.
4444 */
45- uint8_t esp_stub_lib_rx_one_char (void );
45+ uint8_t stub_lib_uart_rx_one_char (void );
4646
4747/**
4848 * @brief Flush any buffered transmit data.
4949 */
50- void esp_stub_lib_tx_flush (void );
50+ void stub_lib_uart_tx_flush (void );
5151
5252#ifdef __cplusplus
5353}
Original file line number Diff line number Diff line change @@ -11,27 +11,27 @@ extern uint8_t uart_tx_one_char(uint8_t ch);
1111extern uint8_t uart_rx_one_char (void );
1212extern void uart_tx_flush (void );
1313
14- void esp_stub_lib_delay_us (uint32_t us )
14+ void stub_lib_delay_us (uint32_t us )
1515{
1616 ets_delay_us (us );
1717}
1818
19- uint16_t esp_stub_lib_crc16_le (uint16_t crc , const uint8_t * buf , uint32_t len )
19+ uint16_t stub_lib_crc16_le (uint16_t crc , const uint8_t * buf , uint32_t len )
2020{
2121 return crc16_le (crc , buf , len );
2222}
2323
24- uint8_t esp_stub_lib_tx_one_char (uint8_t c )
24+ uint8_t stub_lib_uart_tx_one_char (uint8_t c )
2525{
2626 return uart_tx_one_char (c );
2727}
2828
29- uint8_t esp_stub_lib_rx_one_char (void )
29+ uint8_t stub_lib_uart_rx_one_char (void )
3030{
3131 return uart_rx_one_char ();
3232}
3333
34- void esp_stub_lib_tx_flush (void )
34+ void stub_lib_uart_tx_flush (void )
3535{
3636 uart_tx_flush ();
3737}
Original file line number Diff line number Diff line change 22 src/uart.c
33 src/flash.c
44 src/rom-patched.c
5+ src/rom-missings.c
56)
67
78add_library (${ESP_TARGET_LIB} STATIC ${srcs} )
Original file line number Diff line number Diff line change 44 * SPDX-License-Identifier: Apache-2.0 OR MIT
55 */
66
7+ #include <stdint.h>
8+ #include <err.h>
79#include <target/flash.h>
10+ #include <private/rom_flash.h>
11+
12+ extern esp_rom_spiflash_chip_t g_rom_flashchip ;
813
914void stub_target_flash_init (void * state )
1015{
@@ -18,8 +23,22 @@ void stub_target_flash_deinit(const void *state)
1823 // TODO: Implement
1924}
2025
26+ const struct esp_rom_spiflash_chip * stub_target_flash_get_config (void )
27+ {
28+ return & g_rom_flashchip ;
29+ }
30+
2131uint32_t stub_target_flash_get_flash_id (void )
2232{
2333 // TODO: Implement
2434 return 0 ;
2535}
36+
37+ int stub_target_flash_read_buff (uint32_t addr , void * buffer , uint32_t size )
38+ {
39+ (void )addr ;
40+ (void )buffer ;
41+ (void )size ;
42+ // TODO: Implement
43+ return STUB_LIB_FAIL ;
44+ }
Original file line number Diff line number Diff line change 1+ /*
2+ * SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
3+ *
4+ * SPDX-License-Identifier: Apache-2.0 OR MIT
5+ */
6+ #include <stdint.h>
7+ #include "private/soc_utils.h"
8+
9+ void uart_tx_flush (void )
10+ {
11+ const uint32_t UART0_STATUS_REG = 0x60000F1C ;
12+ const uint32_t UART_STATUS_TX_EMPTY = 0xFF << 16 ;
13+
14+ while (REG_READ (UART0_STATUS_REG ) & UART_STATUS_TX_EMPTY ) {
15+ // wait for TX fifo to be empty, ROM code works the same way
16+ }
17+ }
You can’t perform that action at this time.
0 commit comments