[STM32F7] STM32F769I-DISCO评测(9)IAR快速移植STemwin

[复制链接]
2659|0
 楼主| ddllxxrr 发表于 2017-1-12 21:32 | 显示全部楼层 |阅读模式

STemWin是SEGGER公司授权给ST(意法半导体)的。使用ST芯片的用户可以免费使用STemWin。

下F7的CUBE中就有STemWin的目录
我的在F:\360Downloads\STM32Cube_FW_F7_V1.5.0\Middlewares\ST\STemWin


先建立两个工程子目录:

GUI_CONFIG
GUI_LIB



得用个能显示图片的例程就选上次的JPEG,这样图像初始化就省下了
工程路径:
F:\360Downloads\STM32Cube_FW_F7_V1.5.0\Projects\STM32F769I-Discovery\Examples\JPEG\JPEG_DecodingUsingFs_DMA


在GUI_LIB子目录中加入库文件:
STemwin.jpg
STemWin532_CM7_IAR.a
路径:F:\360Downloads\STM32Cube_FW_F7_V1.5.0\Middlewares\ST\STemWin\Lib


在GUI_CONFIG中加入如下:
STM32769I_DISCO_STemWin_Addons_IAR.a
路径F:\360Downloads\STM32Cube_FW_F7_V1.5.0\Projects\STM32F769I-Discovery\Demonstration\STemWin_Addons
GUI_X.c
路径F:\360Downloads\STM32Cube_FW_F7_V1.5.0\Projects\STM32F769I-Discovery\Demonstration\Config
GUIConf.c
路径F:\360Downloads\STM32Cube_FW_F7_V1.5.0\Projects\STM32F769I-Discovery\Demonstration\Config
LCDConf_CmdMode_TE.c
路径:F:\360Downloads\STM32Cube_FW_F7_V1.5.0\Middlewares\ST\STemWin\OS

加完后的情况如下图:
STemwin2.jpg

然后在MAIN.c中修改下显示的内容:
  1. /* Includes ------------------------------------------------------------------*/
  2. #include "main.h"
  3. #include "stm32F769i_discovery.h"
  4. #include "stm32F769i_discovery_ts.h"
  5. #include "GUI.h"
  6. /** @addtogroup STM32F7xx_HAL_Examples
  7.   * @{
  8.   */

  9. /** @addtogroup JPEG_DecodingUsingFs_DMA
  10.   * @{
  11.   */

  12. /* Private typedef -----------------------------------------------------------*/
  13. /* Private define ------------------------------------------------------------*/
  14. #if (JPEG_RGB_FORMAT == JPEG_ARGB8888)
  15.   #define BYTES_PER_PIXEL 4  /* Number of bytes in a pixel */
  16. #elif (JPEG_RGB_FORMAT == JPEG_RGB888)
  17.   #define BYTES_PER_PIXEL 3  /* Number of bytes in a pixel */
  18. #elif (JPEG_RGB_FORMAT == JPEG_RGB565)
  19.   #define BYTES_PER_PIXEL 2  /* Number of bytes in a pixel */
  20. #else
  21.   #error "unknown JPEG_RGB_FORMAT "
  22. #endif /* JPEG_RGB_FORMAT */
  23. /* Private macro -------------------------------------------------------------*/

  24. /* Private variables ---------------------------------------------------------*/
  25. FATFS SDFatFs;  /* File system object for SD card logical drive */
  26. char SDPath[4]; /* SD card logical drive path */
  27. FIL JPEG_File;  /* File object */

  28. uint32_t JpegProcessing_End = 0;
  29. static uint32_t LCD_X_Size = 0;

  30. JPEG_HandleTypeDef    JPEG_Handle;

  31. static DMA2D_HandleTypeDef    DMA2D_Handle;
  32. static JPEG_ConfTypeDef       JPEG_Info;

  33. /* Private function prototypes -----------------------------------------------*/
  34. static void SystemClock_Config(void);
  35. static void LCD_BriefDisplay(void);
  36. static void LCD_FileErrorDisplay(void);
  37. static void DMA2D_CopyBuffer(uint32_t *pSrc, uint32_t *pDst, uint16_t x, uint16_t y, uint16_t xsize, uint16_t ysize);
  38. static void CPU_CACHE_Enable(void);



  39. extern void LCD_SetUpdateRegion(int idx);
  40. extern void LCD_ReqTear(void);
  41. extern void DSI_IRQHandler(void);
  42. /* Private functions ---------------------------------------------------------*/


  43. /**
  44.   * [url=home.php?mod=space&uid=247401]@brief[/url]  Main program
  45.   * @param  None
  46.   * @retval None
  47.   */
  48. int main(void)
  49. {
  50.   uint32_t xPos = 0, yPos = 0;
  51.   uint8_t  lcd_status = LCD_OK;
  52.   
  53.   /* Enable the CPU Cache */
  54.   CPU_CACHE_Enable();

  55.   /* STM32F7xx HAL library initialization:
  56.        - Configure the Flash ART accelerator on ITCM interface
  57.        - Systick timer is configured by default as source of time base, but user
  58.          can eventually implement his proper time base source (a general purpose
  59.          timer for example or other time source), keeping in mind that Time base
  60.          duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and
  61.          handled in milliseconds basis.
  62.        - Set NVIC Group Priority to 4
  63.        - Low Level Initialization
  64.      */
  65.   HAL_Init();
  66.   
  67.   /* Configure the system clock to 200 MHz */
  68.   SystemClock_Config();

  69.   /* Initialize the LED1 (Red LED , set to On when error) */
  70.   BSP_LED_Init(LED1);

  71.   /*##-1- JPEG Initialization ################################################*/   
  72.   /* Init The JPEG Look Up Tables used for YCbCr to RGB conversion   */    /* Init The JPEG Color Look Up Tables used for YCbCr to RGB conversion   */
  73.   JPEG_InitColorTables();

  74.    /* Init the HAL JPEG driver */
  75.   JPEG_Handle.Instance = JPEG;
  76.   HAL_JPEG_Init(&JPEG_Handle);  

  77.   /*##-2- LCD Configuration ##################################################*/  
  78.   /* Initialize the LCD   */
  79.   lcd_status = BSP_LCD_Init();
  80.   if(lcd_status != LCD_OK)
  81.   {
  82.     OnError_Handler();
  83.   }
  84.   
  85.    
  86.          __HAL_RCC_CRC_CLK_ENABLE();
  87.          __HAL_RCC_BKPSRAM_CLK_ENABLE();
  88.         GUI_Init();
  89.       
  90.   GUI_SetLayerVisEx (1, 0);
  91.   GUI_SelectLayer(0);
  92.   GUI_SetBkColor(GUI_BLUE);
  93.   GUI_Clear();
  94.   GUI_DispStringAt(" STM32F769I Discovery",60,40);
  95.   GUI_SetFont(&GUI_Font32B_ASCII);
  96.   GUI_DispStringAt("Hello world! www.21ic.com", 0, 180);
  97.    GUI_SetFont(&GUI_FontD48);
  98.   GUI_DispStringAt("1234567890", 0, 250);
  99.   /* Infinite loop */
  100.   while (1)
  101.   {
  102.   }
  103. }



最后运行的结果如下:
IMG_20170108_115006.jpg

IMG_20170108_120033.jpg

到此在IAR上STemwin移植成功,至于更多功能,得慢慢体验了。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

个人签名:http://shop34182318.taobao.com/ http://shop562064536.taobao.com

2404

主题

7001

帖子

68

粉丝
快速回复 在线客服 返回列表 返回顶部