ulp_riscv.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. #pragma once
  15. #include <stdint.h>
  16. #include <stddef.h>
  17. #include <stdlib.h>
  18. #include "esp_err.h"
  19. #include "soc/soc.h"
  20. #include "ulp_common.h"
  21. /**
  22. * @brief Run the program loaded into RTC memory
  23. * @return ESP_OK on success
  24. */
  25. esp_err_t ulp_riscv_run(void);
  26. /**
  27. * @brief Load ULP-RISC-V program binary into RTC memory
  28. *
  29. * Different than ULP FSM, the binary program has no special format, it is the ELF
  30. * file generated by RISC-V toolchain converted to binary format using objcopy.
  31. *
  32. * Linker script in components/ulp/ld/esp32s2.ulp.riscv.ld produces ELF files which
  33. * correspond to this format. This linker script produces binaries with load_addr == 0.
  34. *
  35. * @param program_binary pointer to program binary
  36. * @param program_size_bytes size of the program binary
  37. * @return
  38. * - ESP_OK on success
  39. * - ESP_ERR_INVALID_SIZE if program_size_bytes is more than 8KiB
  40. */
  41. esp_err_t ulp_riscv_load_binary(const uint8_t* program_binary, size_t program_size_bytes);