stm32fxx_STUaddressing.c 977 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #include "stm32fxx_STUaddressing.h"
  2. volatile uint32_t testCell_1 __attribute__((at(0x20000600))); //必须在Zero段,否则编译会提示内存冲突
  3. volatile uint32_t testCell_2 __attribute__((at(0x20000610)));
  4. uint8_t STU_AddressingTest(void)
  5. {
  6. uint32_t tmpData;
  7. testCell_1 = 0x55555555;
  8. testCell_2 = 0xAAAAAAAA;
  9. tmpData = testCell_1;
  10. if( tmpData != 0x55555555 )
  11. {
  12. /*err*/
  13. return(ERROR);
  14. }
  15. tmpData = testCell_2;
  16. if( tmpData != 0xAAAAAAAA )
  17. {
  18. /*err*/
  19. return(ERROR);
  20. }
  21. testCell_1 = 0xAAAAAAAA;
  22. testCell_2 = 0x55555555;
  23. tmpData = testCell_1;
  24. if( tmpData != 0xAAAAAAAA )
  25. {
  26. /*err*/
  27. return(ERROR);
  28. }
  29. tmpData = testCell_2;
  30. if( tmpData != 0x55555555 )
  31. {
  32. /*err*/
  33. return(ERROR);
  34. }
  35. testCell_1 = 0x55555555;
  36. testCell_2 = 0xAAAAAAAA;
  37. tmpData = testCell_1;
  38. if( tmpData != 0x55555555 )
  39. {
  40. /*err*/
  41. return(ERROR);
  42. }
  43. tmpData = testCell_2;
  44. if( tmpData != 0xAAAAAAAA )
  45. {
  46. /*err*/
  47. return(ERROR);
  48. }
  49. return(SUCCESS);
  50. }