A board support package for the LPC4088 Display Module.

Dependencies:   DM_HttpServer DM_USBHost

Dependents:   lpc4088_displaymodule_emwin lpc4088_displaymodule_demo_sphere sampleGUI sampleEmptyGUI ... more

Fork of DMSupport by EmbeddedArtists AB

Revision:
42:bbfe299d4a0c
Parent:
41:e06e764ff4fd
--- a/DMBoard.cpp	Wed Oct 23 06:59:29 2019 +0000
+++ b/DMBoard.cpp	Mon Nov 04 14:32:50 2019 +0000
@@ -26,7 +26,9 @@
 
 #if defined(DM_BOARD_ENABLE_MEASSURING_PINS)
   #include "meas.h"
-#endif        
+#endif      
+
+#include "dm_rtc.h"  
 
 /******************************************************************************
  * Configuration Compatibility Control
@@ -74,7 +76,8 @@
 DMBoard::DMBoard() : 
     _initialized(false),
 #if defined(DM_BOARD_USE_MCI_FS)
-    _mcifs("mci", P4_16),
+    _mcifs(P4_16),
+    _mciFatFs("mci"),
 #endif
 #if defined(DM_BOARD_USE_QSPI_FS)
     _qspifs("qspi"),
@@ -101,6 +104,17 @@
   BoardError err = Ok;
   if (!_initialized) {
     do {
+      
+      /* 
+       * By default mbed OS 5 comes with the MPU enabled and prevents execution
+       * from RAM and writes to ROM. We need to be able to execute from EAM
+       * (e.g. the BIOS functionality) and also write to ROM area (we are e.g.
+       * using the EEPROM peripheral in the LPC4088 which has an address space
+       * within the ROM area).
+       */      
+      mbed_mpu_manager_lock_ram_execution();
+      mbed_mpu_manager_lock_rom_write();
+      
       // Turn off the buzzer
       _buzzer.period_ms(1);
       _buzzer = 0;
@@ -129,6 +143,10 @@
       freopen("/null", "w", stdout);
 #endif
 
+#if defined(DM_BOARD_USE_MCI_FS)
+    _mciFatFs.mount(&_mcifs);
+#endif
+
 #if defined(DM_BOARD_USE_QSPI) || defined(DM_BOARD_USE_QSPI_FS)
       if (SPIFI::instance().init() != SPIFI::Ok) {
         err = SpifiError;
@@ -156,6 +174,12 @@
         break;
       }
 #endif
+      /*
+       * With mbed OS 5 the rtc driver in target/hal has been disabled
+       * Adding an external rtc driver instead.
+       */
+      attach_rtc(&dm_read_rtc, &dm_write_rtc, &dm_init_rtc, &dm_isenabled_rtc);
+
       _initialized = true;
     } while(0);
   }