using iar with stm32f4 discovery for tgr 2012

14
TGR2012 .. ! "#ก$ $.$

Upload: supachai-vorapojpisut

Post on 21-May-2015

2.774 views

Category:

Technology


1 download

DESCRIPTION

This is a Thai slide to guide how to modify the Ethernet example of STM324xG Evaluation board to STM32F4 Discovery board. ขั้นตอนในการใช้ IAR evaluation (ฟีเจอร์เต็ม แต่ใช้ได้แค่ 30 วัน) กับตัวอย่าง LWIP + FreeRTOS ของบอร์ด STM324xG Evaluation โดยใช้เอกสารของ aimagin.com เป็นต้นแบบ การปรับแก้อยู่ในระดับ minimal โดยทดสอบด้วย ping และเบราเซอร์

TRANSCRIPT

Page 1: Using IAR with STM32F4 Discovery for TGR 2012

ก������������� ���������� TGR2012

��.�

�.����

�� ��

����

���� �!

�"#�

���ก�

�$��

���� $

. ��$

����

��

Page 2: Using IAR with STM32F4 Discovery for TGR 2012

���ก��%&'��()*��(�$

1. ���+ก�$ IAR Embedded Workbench ������'���ก www.iar.com ,�-*'. ก+�� evaluation %�- 30 �� *�.) ,�-��-�%&'� �$*$�%�-,�/�ก��� 32 kB

2. %&'�������� ��� stm32f4x7_eth_lwip.ziphttp://www.st.com/internet/com/SOFTWARE_RESOURCES/SW_COMPONENT/FIRMWARE/stm32f4x7_eth_lwip.zip

3. %&'�*&0��$+���������� ��*ก�� ST-LINK/V2http://www.st.com/internet/com/SOFTWARE_RESOURCES/

TOOL/DEVICE_PROGRAMMER/stm32_st-link_utility.zip

4. * ก���+#��ก��,�-�� ��� aMG F4Connect

https://www.aimagin.com/amg-f4connect.html

5. %&'�������� ��� STM32F4 Discoveryhttp://www.st.com/internet/com/SOFTWARE_RESOURCES/SW_COMPONENT/FIRMWARE/stm32f4discovery_fw.zip

Page 3: Using IAR with STM32F4 Discovery for TGR 2012

��� ����() 1 ก������+ก-���� Project\FreeRTOS\httpserver_netconn\EWARM

*�0�%&'� Project.eww +'-���' ,�-*$1 Project � Rebuild All

���%�-�'ก�� build *�2 0 error +'# 0 warning

Page 4: Using IAR with STM32F4 Discovery for TGR 2012

�'�ก3���()�.) ���� STM324xG_EVAL ��ก�4*'. ก options

,+�5� Target ,�-*'. ก���������#$�'�' STM32F407VG

�.���.) ��ก�"�*�2 STM32F407VG

Page 5: Using IAR with STM32F4 Discovery for TGR 2012

,+�5� Library Configuration *'. ก&6*� �� Semihosted � Via SWO +'# CMSIS-DSP Library

ก��,�- Semihosted ก�� SWO �#���,�-,�- printf() ก��ก ITM (ST-Link) %�-

Page 6: Using IAR with STM32F4 Discovery for TGR 2012

,+�5� Library Options *'. ก formatter *����()���*�2 *�� Tiny ������� printf() +'# Small ������� scanf()

'���� overhead ,ก�������' �������1�+��3 printf() +��*�(�����

Page 7: Using IAR with STM32F4 Discovery for TGR 2012

�'��%��$�� C/C++ Compiler ,+�5� Optimizations

,�-*'. ก*�2 None

�ก*'�ก Optimization *�.) '����$*�()�3 ��7ก�()$���ก� $%�*' ��� ,�- volatile ก��ก�����+�����$ �#����%�- (ก 1 ��

Page 8: Using IAR with STM32F4 Discovery for TGR 2012

,+�5� Preprocessor ,�-*��)$ symbols �. HSE_VALUE=8000000

��ก�- ก��*��)$%'����( .) ,�-*��)$%�*�5ก� �(, Include Directories �-��

��� OSC 3 � ��� STM32F4 Discovery �. 8 MHz 89)�����ก� ����(),�-,����(4 �9�- ����,�-� ��'- ก�

Page 9: Using IAR with STM32F4 Discovery for TGR 2012

�'��%��$�� Debugger ,+�5� Setup ,�-*'. ก*�2 ST-LINK

��ก�4�������$*�5� CPU ,�-� ��'- �. 168 MHz

Page 10: Using IAR with STM32F4 Discovery for TGR 2012

+ก-%3%&'�8 �����-�*�.) ����:����+���,�-� ��'-

1. %&'� system_stm32f4xx.c ������ 149 – *�'()���� -� � clock ��ก OSC (8MHz)

#define PLL_M 8

2. %&'� main.h

������ 37 – ,�- comment *�.) �ก*'�กก��,�- LCD

//#define USE_LCD /* enable LCD */

������ 53-56 – ���� static IP address

#define IP_ADDR0 192

#define IP_ADDR1 168

#define IP_ADDR2 1

#define IP_ADDR3 10

������ 83 – ,�- comment *�.) �ก*'�กก��,�-3� MCO

// #define PHY_CLOCK_MCO

#define GW_ADDR0 192

#define GW_ADDR1 168

#define GW_ADDR2 1

#define GW_ADDR3 1

Page 11: Using IAR with STM32F4 Discovery for TGR 2012

+ก-%33� I/O ,�-� ��'- ก��� ��� amgF4 Discovery

89)�-����ก� ��� H I +'# G $���� ��� A +'# B

3. %&'� stm32f4x7_eth_bsp.c ETH_MII_CRS (PH2 � PA0)

ETH_MII_COL (PH3 � PA3)

ETH_MII_RX_ER (PI10 � PB10)

ETH_MII_RXD2 (PH6 � PB0)

ETH_MII_RXD3 (PH7 � PB1)

ETH_MII_TX_EN/ETH_RMII_TX_EN (PG11 � PB11)

ETH_MII_TXD0/ETH_RMII_TXD0 (PG13 � PB12)

ETH_MII_TXD1/ETH_RMII_TXD1 (PG14 � PB13)

+ก-%3��$8 �����-�,* ก����1�$. amgF4 Discovery

Page 12: Using IAR with STM32F4 Discovery for TGR 2012

�����4 ST-LINK Utility ��ก�4*�(�ก���+ก�$ ST-Link Upgrade

+'-��9*�(����� USB ก��� ��� STM32F4 Discovery *�.) ��*ก��*&0��$+���

*&0��$+��� 2.J16.S0 � ���&6*� �� SWO �'���ก ��*ก��,�-; ���� ก+'-�*�(��,�$� +'#,�-���+ก�$ ST-Link Utility ��' *�.) $��

Page 13: Using IAR with STM32F4 Discovery for TGR 2012

��� �*&0��$+����()����+ก-+'-� ��� build � debug

��ก�4�9��) Go *�.) ,�-*&0��$+�������

*&0��$+����#,�-*�'�����9)ก� �#*��)$*�5�*8���&*� ��

Page 14: Using IAR with STM32F4 Discovery for TGR 2012

��� �*&0��$+����-��ก��,�- ping

��ก�4,�-*���*8 ��*�.) �1�-�*�5�

��ก����� %$�%�- ,�-*�5���� IP address 3 *��*� ���()*�2*ก�*���