@@ -11,12 +11,7 @@ bool repeating_timer_callback(__unused struct repeating_timer *t) {
1111}
1212
1313int main () {
14- // Check no user IRQs are available
15- int irq = user_irq_claim_unused (false);
16- if (irq != -1 ) {
17- goto done ;
18- }
19- // Request user IRQs from secure, which stdio_usb will use
14+ // Request user IRQ from secure, which stdio_usb will use
2015 user_irq_request_unused_from_secure (1 );
2116
2217 stdio_usb_init ();
@@ -25,19 +20,15 @@ int main() {
2520 struct repeating_timer timer ;
2621 add_repeating_timer_ms (1000 , repeating_timer_callback , NULL , & timer );
2722
28- printf ("My clock speed is %dHz\n" , clock_get_hz (clk_sys ));
29-
3023 for (int i = 0 ; i < 10 ; i ++ ) {
3124 printf ("Hello, world, from non-secure!\n" );
3225 rom_secure_call (1 , 2 , 3 , i , SECURE_CALL_PRINT_VALUES );
3326 sleep_ms (1000 );
3427 }
3528
36- done :
29+ // Demonstrate triggering a secure fault, by reading secure memory at start of SRAM
3730 printf ("Triggering secure fault by reading secure memory\n" );
38- // Secure memory is the rest of SRAM after the heap limit
39- extern uint32_t __HeapLimit ;
40- volatile uint32_t thing = * (uint32_t * )__HeapLimit ;
31+ volatile uint32_t thing = * (uint32_t * )SRAM_BASE ;
4132 printf ("Some secure memory is %08x\n" , thing );
4233
4334 return 0 ;
0 commit comments