Advertisement
Guest User

Untitled

a guest
Jul 27th, 2016
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. void memory_test()
  2. {
  3. #define WRAPPED(x) ((void*)(((uint32_t)(x)) | 0x10000000))
  4. static uint32_t memtest = 0x123;
  5. volatile uint32_t *p1 = &memtest;
  6. volatile uint32_t *p2 = WRAPPED(&memtest);
  7. volatile uint32_t *p3 = UNCACHEABLE(&memtest);
  8.  
  9. DryosDebugMsg( 0, 0, "%s p1 p2 p3", "POINTER ");
  10. DryosDebugMsg( 0, 0, "%s 0x%08X 0x%08X 0x%08X", "ADDRESS ", p1, p2, p3);
  11. DryosDebugMsg( 0, 0, "%s 0x%08X 0x%08X 0x%08X", "(init) ", *p1, *p2, *p3);
  12. memtest++;
  13. DryosDebugMsg( 0, 0, "%s 0x%08X 0x%08X 0x%08X", "memtest++", *p1, *p2, *p3);
  14. (*p1)++;
  15. DryosDebugMsg( 0, 0, "%s 0x%08X 0x%08X 0x%08X", "(*p1)++ ", *p1, *p2, *p3);
  16. (*p2)++;
  17. DryosDebugMsg( 0, 0, "%s 0x%08X 0x%08X 0x%08X", "(*p2)++ ", *p1, *p2, *p3);
  18. (*p3)++;
  19. DryosDebugMsg( 0, 0, "%s 0x%08X 0x%08X 0x%08X", "(*p3)++ ", *p1, *p2, *p3);
  20.  
  21. }
  22.  
  23.  
  24. // Output
  25.  
  26. init:00b1c75c:00:00: POINTER p1 p2 p3
  27. init:00b1c77c:00:00: ADDRESS 0x00B7F204 0x10B7F204 0x40B7F204
  28. init:00b1c7a8:00:00: (init) 0x00000123 0x00000123 0x00000123
  29. init:00b1c7e0:00:00: memtest++ 0x00000124 0x00000123 0x00000123
  30. init:00b1c818:00:00: (*p1)++ 0x00000125 0x00000123 0x00000123
  31. init:00b1c850:00:00: (*p2)++ 0x00000125 0x00000123 0x00000123
  32. init:00b1c888:00:00: (*p3)++ 0x00000125 0x00000124 0x00000124
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement