1 // Copyright 2010-2020 Espressif Systems (Shanghai) PTE LTD 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #pragma once 16 #include <stdint.h> 17 #include <stddef.h> 18 #include <stdlib.h> 19 #include "esp_err.h" 20 #include "soc/soc.h" 21 #include "ulp_common.h" 22 23 /** 24 * @brief Run the program loaded into RTC memory 25 * @return ESP_OK on success 26 */ 27 esp_err_t ulp_riscv_run(void); 28 29 /** 30 * @brief Load ULP-RISC-V program binary into RTC memory 31 * 32 * Different than ULP FSM, the binary program has no special format, it is the ELF 33 * file generated by RISC-V toolchain converted to binary format using objcopy. 34 * 35 * Linker script in components/ulp/ld/esp32s2.ulp.riscv.ld produces ELF files which 36 * correspond to this format. This linker script produces binaries with load_addr == 0. 37 * 38 * @param program_binary pointer to program binary 39 * @param program_size_bytes size of the program binary 40 * @return 41 * - ESP_OK on success 42 * - ESP_ERR_INVALID_SIZE if program_size_bytes is more than 8KiB 43 */ 44 esp_err_t ulp_riscv_load_binary(const uint8_t* program_binary, size_t program_size_bytes); 45