main.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: Unlicense OR CC0-1.0
  5. */
  6. /* ULP-RISC-V example
  7. This example code is in the Public Domain (or CC0 licensed, at your option.)
  8. Unless required by applicable law or agreed to in writing, this
  9. software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
  10. CONDITIONS OF ANY KIND, either express or implied.
  11. This code runs on ULP-RISC-V coprocessor
  12. */
  13. #include "ulp_riscv.h"
  14. #include "ulp_riscv_utils.h"
  15. #include "ulp_riscv_print.h"
  16. #include "ulp_riscv_uart_ulp_core.h"
  17. #include "sdkconfig.h"
  18. static ulp_riscv_uart_t s_print_uart;
  19. int main (void)
  20. {
  21. ulp_riscv_uart_cfg_t cfg = {
  22. .tx_pin = CONFIG_EXAMPLE_UART_TXD,
  23. };
  24. ulp_riscv_uart_init(&s_print_uart, &cfg);
  25. ulp_riscv_print_install((putc_fn_t)ulp_riscv_uart_putc, &s_print_uart);
  26. int cnt = 0;
  27. while(1) {
  28. ulp_riscv_print_str("Hello World from ULP-RISCV!\n");
  29. ulp_riscv_print_str("Cnt: 0x");
  30. ulp_riscv_print_hex(cnt);
  31. ulp_riscv_print_str("\n");
  32. cnt++;
  33. ulp_riscv_delay_cycles(1000 * ULP_RISCV_CYCLES_PER_MS);
  34. }
  35. }