簡單介紹下安裝, 下載ecos-install.tcl,然后用SHELL執(zhí)行安裝,選ARM工具鏈及源碼即可. 安裝ecos3.0源碼后,在目錄ecos-3.0\packages\hal\cortexm\stm32\下能找到EVAL的開發(fā)板, 這塊開發(fā)板有外擴(kuò)的RAM及NORFlash,手邊沒有相應(yīng)的板子,所以這里要修改. 板子是105RC的,所以復(fù)制stm3210e_eval目錄為stm32f105_tcu,并修改其中的CDL及源碼、LDI等文件,包括文件名及內(nèi)容。 CDL根據(jù)板子修改如下:文件名, 修改串口號, # implements CYGINT_HAL_STM32_UART0 # implements CYGINT_HAL_STM32_UART1 # walnutcy 2011.07.08 implements CYGINT_HAL_STM32_UART3 implements CYGINT_HAL_STM32_UART4 修改啟動方式: cdl_component CYG_HAL_STARTUP { display "Startup type" flavor data default_value {"ROM"} legal_values {"ROM"} 修改內(nèi)存布局: cdl_component CYGHWR_MEMORY_LAYOUT { display "Memory layout" flavor data no_define calculated { "cortexm_stm32f105_tcu_rom" } include/pkgconf下只留兩個文件: mlt_cortexm_stm32f105_tcu_rom.ldi, mlt_cortexm_stm32f105_tcu_rom.h H文件修改后如下: #define CYGMEM_REGION_sram (0x20000000) #define CYGMEM_REGION_sram_SIZE (0x00010000-CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE) #define CYGMEM_REGION_sram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) #define CYGMEM_REGION_flash (0x08000000) #define CYGMEM_REGION_flash_SIZE (0x00080000) #define CYGMEM_REGION_flash_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) // walnutcy 2011.07.07 #define CYGMEM_REGION_ram CYGMEM_REGION_sram #define CYGMEM_REGION_ram_SIZE CYGMEM_REGION_sram_SIZE //#define CYGMEM_REGION_ram (0x68000000) //#define CYGMEM_REGION_ram_SIZE (0x00100000) //#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) //#define CYGMEM_REGION_rom (0x64000000) //#define CYGMEM_REGION_rom_SIZE (0x01000000) //#define CYGMEM_REGION_rom_ATTR (CYGMEM_REGION_ATTR_R) LDI文件修改后如下: MEMORY { sram: ORIGIN = 0x20000000, LENGTH = 0x00010000-CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE flash : ORIGIN = 0x08000000, LENGTH = 0x00080000 } SECTIONS { SECTIONS_BEGIN SECTION_rom_vectors (flash, 0x08000000, LMA_EQ_VMA) SECTION_RELOCS (flash, ALIGN (0x8), LMA_EQ_VMA) SECTION_text (flash, ALIGN (0x8), LMA_EQ_VMA) SECTION_fini (flash, ALIGN (0x8), LMA_EQ_VMA) SECTION_rodata (flash, ALIGN (0x8), LMA_EQ_VMA) SECTION_rodata1 (flash, ALIGN (0x8), LMA_EQ_VMA) SECTION_fixup (flash, ALIGN (0x8), LMA_EQ_VMA) SECTION_gcc_except_table (flash, ALIGN (0x8), LMA_EQ_VMA) SECTION_eh_frame (flash, ALIGN (0x8), LMA_EQ_VMA) SECTION_got (flash, ALIGN (0x8), LMA_EQ_VMA) SECTION_sram (sram, 0x20000400, FOLLOWING (.got)) SECTION_data (sram, ALIGN (0x8), FOLLOWING (.sram)) SECTION_bss (sram, ALIGN (0x8), LMA_EQ_VMA) CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); SECTIONS_END } 其他代碼修改部分: stm32f105_tcu_misc.c修改, hal_system_init函數(shù)中注釋掉部分,如下: // Set up GPIO lines for external bus //base = CYGHWR_HAL_STM32_GPIOD; //HAL_WRITE_UINT32( base+CYGHWR_HAL_STM32_GPIO_CRL, 0x44bb44bb ); //HAL_WRITE_UINT32( base+CYGHWR_HAL_STM32_GPIO_CRH, 0xbbbbbbbb ); //base = CYGHWR_HAL_STM32_GPIOE; //HAL_WRITE_UINT32( base+CYGHWR_HAL_STM32_GPIO_CRL, 0xbbbbb4bb ); //HAL_WRITE_UINT32( base+CYGHWR_HAL_STM32_GPIO_CRH, 0xbbbbbbbb ); //base = CYGHWR_HAL_STM32_GPIOF; //HAL_WRITE_UINT32( base+CYGHWR_HAL_STM32_GPIO_CRL, 0x44bbbbbb ); //HAL_WRITE_UINT32( base+CYGHWR_HAL_STM32_GPIO_CRH, 0xbbbb4444 ); //base = CYGHWR_HAL_STM32_GPIOG; //HAL_WRITE_UINT32( base+CYGHWR_HAL_STM32_GPIO_CRL, 0x44bbbbbb ); //HAL_WRITE_UINT32( base+CYGHWR_HAL_STM32_GPIO_CRH, 0x44444bb4 ); //---walnutcy 2011.07.07 // Set up FSMC NOR/SRAM bank 2 for NOR Flash //base = CYGHWR_HAL_STM32_FSMC; //HAL_WRITE_UINT32( base+CYGHWR_HAL_STM32_FSMC_BCR2, 0x00001059 ); //HAL_WRITE_UINT32( base+CYGHWR_HAL_STM32_FSMC_BTR2, 0x10000705 ); // Set up FSMC NOR/SRAM bank 3 for SRAM //HAL_WRITE_UINT32( base+CYGHWR_HAL_STM32_FSMC_BCR3, 0x00001011 ); //HAL_WRITE_UINT32( base+CYGHWR_HAL_STM32_FSMC_BTR3, 0x00000200 ); stm32f105_tcu_flash.c中修改如下: 刪除AMD NorFlash相關(guān)函數(shù),修改后如下: cyg_stm32_flash_dev hal_stm32_flash_priv; CYG_FLASH_DRIVER(hal_stm32_flash, &cyg_stm32_flash_funs, 0, 0x08000000, 0, 0, 0, &hal_stm32_flash_priv ); 最后是修改ecos.db,在文件的最后添加: package CYGPKG_HAL_CORTEXM_STM32_STM32F105_TCU { alias { "ST STM32F105 TCU HAL" hal_cortexm_stm32f105_tcu } directory hal/cortexm/stm32/stm32f105_tcu script hal_cortexm_stm32_stm32f105_tcu.cdl hardware description " The stm32f105_tcu HAL package provides the support needed to run eCos on the ST STM32F105 TCU board." } target stm32f105_tcu { alias { "ST STM32F105 TCU board" stm32f105 } packages { CYGPKG_HAL_CORTEXM CYGPKG_HAL_CORTEXM_STM32 CYGPKG_HAL_CORTEXM_STM32_STM32F105_TCU CYGPKG_DEVS_FLASH_STM32 CYGPKG_DEVS_FLASH_SPI_M25PXX CYGPKG_IO_SERIAL_CORTEXM_STM32 CYGPKG_DEVS_WALLCLOCK_STM32 CYGPKG_IO_SPI CYGPKG_DEVS_SPI_CORTEXM_STM32 } description "The stm32f105_tcu target provides the packages needed to run eCos on the STM32F105 TCU board." } 完成后,啟動ecos configuration tool, 即可在Build/templates中找到STM32F105 TCU board,選擇redboot編譯即可, 在install目錄會生成redboot.bin,不修改編譯參數(shù)的情況下,大小約為40K。 redboot.elf 是用于調(diào)試的??梢栽趉eil下仿真運(yùn)行,從serial window查看redboot啟動。 注serialwindow目前只能較好地支持STM32的uart1,uart2. |
|