Porting Guide on the Nuklear EVE framework - kaetemi/nuklear_eve GitHub Wiki
The guideline to port the Nuklear EVE framework to other MCU
Index
- Prepare porting environment
- Define build flag for new MCU
- Implement interface for new MCU
- Build and run
- Sample configuration for STM32L476GDISCOVERY board
Content
1. Prepare porting environment
The porting environment of the new MCU need to build below files:
All files in nuklear_eve/src
All files in nuklear_eve/dependencies
All files in nuklear_eve/demo
overview.c, node_editor.c and calculator.c in nuklear/demo/
All the header files are stored at same folder, except the nuklear.h is stored in nuklear/
2. Define build flag for new MCU
1. Open header file nuklear_eve\dependencies\eve_hal\EVE_Config.h and add a new comment for new MCU's macro name, such as "STM32L476GDISCOVERY" Inside "Platform target" group.
2. Add the new MCU's macro name created in step 1 and the EVE platform such as "EVE_GRAPHICS_BT815" to the build flag.
3. Implement interface for new MCU
Each MCU host platform have to implement a list of interface functions designed by Nuklear EVE framework. These implementation should be done in a separated source file
The newly source file and header file should be named "EVE_HalImpl_[MCU_NAME].c" and "EVE_HalImpl_[MCU_NAME].h", and should be placed inside nuklear_eve\dependencies\eve_hal
Below are list of interface functions should be implemented
void EVE_HalImpl_initialize();
void EVE_HalImpl_release();
uint32_t EVE_millis();
void EVE_sleep(uint32_t ms);
void EVE_Mcu_initialize();
void EVE_Millis_initialize();
void EVE_HalImpl_defaults(EVE_HalParameters *parameters);
bool EVE_HalImpl_open(EVE_HalContext *phost, EVE_HalParameters *parameters);
void EVE_HalImpl_close(EVE_HalContext *phost);
void EVE_HalImpl_idle(EVE_HalContext *phost);
void EVE_Hal_startTransfer(EVE_HalContext *phost, EVE_TRANSFER_T rw, uint32_t addr);
void EVE_Hal_endTransfer(EVE_HalContext *phost);
void EVE_Hal_flush(EVE_HalContext *phost);
uint8_t EVE_Hal_transfer8(EVE_HalContext *phost, uint8_t value);
uint16_t EVE_Hal_transfer16(EVE_HalContext *phost, uint16_t value);
uint32_t EVE_Hal_transfer32(EVE_HalContext *phost, uint32_t value);
void EVE_Hal_transferMem(EVE_HalContext *phost, uint8_t *result, const uint8_t *buffer, uint32_t size);
void EVE_Hal_transferProgmem(EVE_HalContext *phost, uint8_t *result, eve_progmem_const uint8_t *buffer, uint32_t size);
uint32_t EVE_Hal_transferString(EVE_HalContext *phost, const char *str, uint32_t index, uint32_t size, uint32_t padMask);
void EVE_Hal_hostCommand(EVE_HalContext *phost, uint8_t cmd);
void EVE_Hal_hostCommandExt3(EVE_HalContext *phost, uint32_t cmd);
void EVE_Hal_powerCycle(EVE_HalContext *phost, bool up);
void EVE_Hal_setSPI(EVE_HalContext *phost, EVE_SPI_CHANNELS_T numchnls, uint8_t numdummy);
bool EVE_UtilImpl_bootupDisplayGpio(EVE_HalContext *phost);
4. Build and run
Build source code with MCU's toolchain, connect hardware and run, the Nuklear EVE start screen shall be seen on LCD
5. Sample configuration for STM32L476GDISCOVERY board
1. Source code modification
- EVE_Config.h: Add "STM32L476GDISCOVERY_PLATFORM" to "Platform target:" group
> Platform target:
> - BT8XXEMU_PLATFORM
> - FT9XX_PLATFORM
> - FT4222_PLATFORM
> - MPSSE_PLATFORM
> - STM32L476GDISCOVERY_PLATFORM
- EVE_Hal.h: Enable variable SpiHandle in struct EVE_HalContext for STM32L476GDISCOVERY_PLATFORM flag
> #if defined(FT4222_PLATFORM) | defined(MPSSE_PLATFORM) || defined(STM32L476GDISCOVERY_PLATFORM)
> void *SpiHandle;
> #endif
- EVE_Platform.h: Add 3 line:
> #if defined(STM32L476GDISCOVERY_PLATFORM)
> #include <EVE_Platform_STM32L476GDISCOVERY.h>
> #endif
- Create newly EVE_HalImpl_STM32L476GDISCOVERY.c and EVE_Platform_STM32L476GDISCOVERY.h
2. Build configuration
- Add below include path to STM32CubeIDE:
Src
Src/Eve
Src/Eve/src
Src/Eve/dependencies/nuklear
Src/Eve/dependencies/mpsse_spi
Src/Eve/dependencies/ftd2xx
Src/Eve/dependencies/ft4222
Src/Eve/dependencies/fatfs
Src/Eve/dependencies/eve_hal
Src/Eve/dependencies/eve_hal/Hdr
Src/Eve/dependencies/esd_core
Drivers/CMSIS/RTOS2/Include
Src/Eve/dependencies/bt8xxemu/include
- Add build flag to STM32CubeIDE:
STM32L476GDISCOVERY_PLATFORM=1
EVE_GRAPHICS_BT815=1
3. Sample project for STM32L476GDISCOVERY board
Please see nuklear_eve/samples/STM32L476GDISCOVERY folder
Please see nuklear_eve/samples/STM32L476GDISCOVERY/Readme.txt for hardware setup, build and run.
END