cmsis_test.c 434 B

1234567891011121314151617181920212223
  1. #include <stdio.h>
  2. #include "RP2040.h"
  3. #include "pico/stdio.h"
  4. __STATIC_FORCEINLINE int some_function(int i) {
  5. return __CLZ(i);
  6. }
  7. static bool pendsv_called;
  8. void PendSV_Handler(void) {
  9. pendsv_called = true;
  10. }
  11. int main(void) {
  12. stdio_init_all();
  13. for(int i=0;i<10;i++) {
  14. printf("%d %d\n", i, some_function(i));
  15. }
  16. SCB->ICSR = SCB_ICSR_PENDSVSET_Msk;
  17. puts(pendsv_called ? "SUCCESS" : "FAILURE");
  18. }