Эх сурвалжийг харах

application/demo_pma: add checker __PMA_PRESENT
make it build pass when CCM not present

Signed-off-by: dongyongtao <dongyongtao@nucleisys.com>

dongyongtao 1 жил өмнө
parent
commit
8ec4cd2da4

+ 10 - 3
application/baremetal/demo_pma/demo_pma.c

@@ -7,7 +7,7 @@
 
 #if !defined(__CCM_PRESENT) || (__CCM_PRESENT != 1)
 /* __CCM_PRESENT should be defined in <Device>.h */
-#error "This example require CPU CCM feature!"
+#warning "This example require CPU CCM feature!"
 #endif
 
 #if !defined(__DCACHE_PRESENT) || (__DCACHE_PRESENT != 1)
@@ -15,6 +15,11 @@
 #error "This example require CPU DCACHE feature!"
 #endif
 
+#if !defined(__PMA_PRESENT) || (__PMA_PRESENT != 1)
+/* __PMA_PRESENT should be defined in <Device>.h */
+#error "This example require CPU PMA feature!"
+#endif
+
 #define ROW_SIZE         512
 #define COL_SIZE         64
 // 32KB
@@ -37,7 +42,7 @@ BENCH_DECLARE_VAR();
 
 int main(void)
 {
-
+#if defined(__CCM_PRESENT) && (__CCM_PRESENT == 1)
     pma_config pma_cfg_r;
     pma_config pma_cfg = {
         // Take care to set the region type and address range, which maybe causing function or performance issue!
@@ -80,7 +85,9 @@ int main(void)
     BENCH_START(Cacheable);
     array_update_by_row();
     BENCH_END(Cacheable);
-
+#else
+    printf("[ERROR]__CCM_PRESENT must be defined as 1 in <Device>.h!\r\n");
+#endif
     return 0;
 }