at91sam7s_usart_usb_20061027

所属分类:USB编程
开发工具:C/C++
文件大小:737KB
下载次数:24
上传日期:2007-11-23 20:55:38
上 传 者flydrago
说明:  USB and USART communication source code for AT91SAM7S

文件列表:
at91sam7s_usart_usb (0, 2006-10-27)
at91sam7s_usart_usb\AT91SAM7S-USART_USB_SAM7S (0, 2006-10-27)
at91sam7s_usart_usb\AT91SAM7S-USART_USB_SAM7S\Compil (0, 2006-10-27)
at91sam7s_usart_usb\AT91SAM7S-USART_USB_SAM7S\Compil\BasicUSART_USB_SAM7S.ewd (40393, 2006-09-25)
at91sam7s_usart_usb\AT91SAM7S-USART_USB_SAM7S\Compil\BasicUSART_USB_SAM7S.ewp (68502, 2006-09-25)
at91sam7s_usart_usb\AT91SAM7S-USART_USB_SAM7S\Compil\BasicUSART_USB_SAM7S.eww (174, 2006-09-25)
at91sam7s_usart_usb\AT91SAM7S-USART_USB_SAM7S\Compil\Resource (0, 2006-10-27)
at91sam7s_usart_usb\AT91SAM7S-USART_USB_SAM7S\Compil\Resource\AT91SAM7S256_FLASH.xcl (8416, 2006-09-25)
at91sam7s_usart_usb\AT91SAM7S-USART_USB_SAM7S\Compil\Resource\AT91SAM7S256_RAM.xcl (8417, 2006-09-25)
at91sam7s_usart_usb\AT91SAM7S-USART_USB_SAM7S\Compil\Resource\SAM7_FLASH.mac (7355, 2006-09-18)
at91sam7s_usart_usb\AT91SAM7S-USART_USB_SAM7S\Compil\Resource\SAM7_RAM.mac (10382, 2006-09-18)
at91sam7s_usart_usb\AT91SAM7S-USART_USB_SAM7S\Compil\sam7.html (273, 2006-09-25)
at91sam7s_usart_usb\AT91SAM7S-USART_USB_SAM7S\Compil\srcIAR (0, 2006-10-27)
at91sam7s_usart_usb\AT91SAM7S-USART_USB_SAM7S\Compil\srcIAR\Cstartup.s79 (11585, 2006-09-25)
at91sam7s_usart_usb\AT91SAM7S-USART_USB_SAM7S\Compil\srcIAR\Cstartup_SAM7.c (5280, 2006-09-25)
at91sam7s_usart_usb\AT91SAM7S-USART_USB_SAM7S\Compil\srcIAR\project.h (1576, 2006-09-25)
at91sam7s_usart_usb\AT91SAM7S-USART_USB_SAM7S\Compil\srcWinARM (0, 2006-10-27)
at91sam7s_usart_usb\AT91SAM7S-USART_USB_SAM7S\Compil\srcWinARM\AT91SAM7S256-RAM.ld (131, 2006-08-04)
at91sam7s_usart_usb\AT91SAM7S-USART_USB_SAM7S\Compil\srcWinARM\AT91SAM7S256-ROM.ld (133, 2006-08-04)
at91sam7s_usart_usb\AT91SAM7S-USART_USB_SAM7S\Compil\srcWinARM\AT91SAM7S256_memory.ldh (765, 2006-08-04)
at91sam7s_usart_usb\AT91SAM7S-USART_USB_SAM7S\Compil\srcWinARM\AT91SAM7S64-RAM.ld (129, 2006-08-04)
at91sam7s_usart_usb\AT91SAM7S-USART_USB_SAM7S\Compil\srcWinARM\AT91SAM7S64-ROM.ld (131, 2006-08-04)
at91sam7s_usart_usb\AT91SAM7S-USART_USB_SAM7S\Compil\srcWinARM\AT91SAM7S64_memory.ldh (778, 2006-08-04)
at91sam7s_usart_usb\AT91SAM7S-USART_USB_SAM7S\Compil\srcWinARM\AT91SAM7S_sections_RAM.ldh (4628, 2006-09-02)
at91sam7s_usart_usb\AT91SAM7S-USART_USB_SAM7S\Compil\srcWinARM\AT91SAM7S_sections_ROM.ldh (4629, 2006-09-02)
at91sam7s_usart_usb\AT91SAM7S-USART_USB_SAM7S\Compil\srcWinARM\Cstartup.S (14364, 2006-10-27)
at91sam7s_usart_usb\AT91SAM7S-USART_USB_SAM7S\Compil\srcWinARM\Cstartup_SAM7.c (5484, 2006-10-27)
at91sam7s_usart_usb\AT91SAM7S-USART_USB_SAM7S\Compil\srcWinARM\project.h (1864, 2006-10-27)
at91sam7s_usart_usb\AT91SAM7S-USART_USB_SAM7S\Compil\srcWinARM\swi.h (3391, 2006-09-10)
at91sam7s_usart_usb\AT91SAM7S-USART_USB_SAM7S\Compil\srcWinARM\swi_handler.S (4285, 2006-09-02)
at91sam7s_usart_usb\AT91SAM7S-USART_USB_SAM7S\Compil\srcWinARM\swi_numbers.h (396, 2006-05-13)
at91sam7s_usart_usb\AT91SAM7S-USART_USB_SAM7S\Compil\StartupScreen.ewsample (0, 2005-09-12)
at91sam7s_usart_usb\AT91SAM7S-USART_USB_SAM7S\Compil\tools.html (27960, 2006-05-12)
at91sam7s_usart_usb\AT91SAM7S-USART_USB_SAM7S\HTML (0, 2006-10-27)
at91sam7s_usart_usb\AT91SAM7S-USART_USB_SAM7S\HTML\at91cdrom.css (7265, 2005-09-12)
at91sam7s_usart_usb\AT91SAM7S-USART_USB_SAM7S\HTML\AT91_title.html (349, 2005-09-12)
at91sam7s_usart_usb\AT91SAM7S-USART_USB_SAM7S\HTML\basic.html (12458, 2005-03-02)
at91sam7s_usart_usb\AT91SAM7S-USART_USB_SAM7S\HTML\pll.xls (35840, 2005-10-14)
at91sam7s_usart_usb\AT91SAM7S-USART_USB_SAM7S\src (0, 2006-10-27)
... ...

USB-UART example ported the gcc original code by Atmel gcc-port by Martin Thomas -------------------------------------------------------------------- This is a port of the demo-project AT91SAM7S-USART_USB_SAM7S which is available from at91.com for the IAR EW to the GNU-toolchain (arm-elf-gcc et. al.). Done for the gcc-port - new: Compil/srcWinARM/* (based on my "gamma"-example files, slightly modified and updated) - new: src/Makefile, src/swi_handler_user.c - modified: cdc_enumerate.c: disabled uint currentReceiveBank (shadows automatic variable) -> avoid warning - midified: cdc_enumarate.c: changed USB PID from 6124 to 6125 to avoid conflicts with the Atmel examples and SAM-BA et al (don't use this PID in production!) - new: inf_drv/*, the file atm6125_virtualserial.inf should be compatible to the inf-file atm6124.inf mentioned in the html-documentation but not available in the package from Atmel. Exception: PID is 6125 in atm6125* as indicated with the filename Installation and Test: ---------------------- **** STEP 1 - compile binaries **** C:\WinARM\examples\at91sam7s_usart_usb\AT91SAM7S-USART_USB_SAM7S\src>make all -------- begin (mode: ROM_RUN) -------- arm-elf-gcc (GCC) 4.1.1 (WinARM) Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Assembling (ARM-only): ../Compil/srcWinARM/Cstartup.S arm-elf-gcc -c -mcpu=arm7tdmi -mthumb-interwork -I. -x assembler-with-cpp -DROM_ RUN -DVECTORS_IN_RAM -D__WinARM__ -D__WINARMSUBMDL_AT91SAM7S256__ -Wa,-adhlns=.. /Compil/srcWinARM/Cstartup.lst,--gdwarf-2 ../Compil/srcWinARM/Cstartup.S -o ../C ompil/srcWinARM/Cstartup.o ROM_MODE enabled remapping enabled Vectors at start of RAM Vectors in section .vectmapped -> .data RCR setting for remapping enabled IRQ_Handler_Entry in section .fastrun -> .data [...] Linking: main.elf arm-elf-gcc -mthumb -mcpu=arm7tdmi -mthumb-interwork -I. -gdwarf-2 -DROM_RUN -DV ECTORS_IN_RAM -D__WinARM__ -D__WINARMSUBMDL_AT91SAM7S256__ -O1 -ffunction-secti ons -fdata-sections -Wall -Wcast-align -Wimplicit -Wpointer-arith -Wswitch -Wre dundant-decls -Wreturn-type -Wshadow -Wunused -Wa,-adhlns=../Compil/srcWinARM/Cs tartup.lst -I../../include -I../Compil/srcWinARM -MD -MP -MF .dep/main.elf.d .. /Compil/srcWinARM/Cstartup.o ../Compil/srcWinARM/swi_handler.o ../Compil/srcWi nARM/Cstartup_SAM7.o swi_handler_user.o main.o cdc_enumerate.o interrupt_Usart.o --output main.elf -nostartfiles -Wl,-Map=main.map,--cref,--gc-sections -lc -lm -lc -lgcc -L../Compil/srcWinARM -T../Compil/srcWinARM/AT91SAM7S256-ROM.l d Creating load file for Flash: main.bin arm-elf-objcopy -O binary main.elf main.bin Creating Extended Listing: main.lss arm-elf-objdump -h -S -C main.elf > main.lss Creating Symbol Table: main.sym arm-elf-nm -n main.elf > main.sym Size after: main.elf : section size addr .text 2732 1048576 .data 4*** 2097152 .bss 232 2097616 .comment 135 0 .debug_aranges 360 0 .debug_pubnames 399 0 .debug_info 9250 0 .debug_abbrev 1691 0 .debug_line 1538 0 .debug_frame 476 0 .debug_str 2707 0 .debug_loc 2038 0 Total 22022 Errors: none -------- end -------- **** STEP 2 - upload to FLASH **** The setting FORMAT=binary will produce a main.bin which can be uploaded to the controller's flash with OpenOCD, SAM-BA and other tools. If your flash-software only supports Intel-HEX change to FORMAT=ihex and do make clean all. The makefile and the included files are prepared to use OpenOCD as flash-software (OpenOCD can handle FT2232-based and Wiggler-type JTAG-interfaces). Flashing is done with a simple make program C:\WinARM\examples\at91sam7s_usart_usb\AT91SAM7S-USART_USB_SAM7S\src>make progra m Programming with OPENOCD openocd_go_flash.cmd Info: openocd.c:82 main(): Open On-Chip Debugger (2006-09-28 20:00 CEST) Warning: arm7_9_common.c:679 arm7_9_assert_reset(): srst resets test logic, too Info: target.c:219 target_init_handler(): executing reset script 'openocd_at9 1sam7s_flash.script' Warning: arm7_9_common.c:785 arm7_9_halt(): target was already halted Warning: arm7_9_common.c:679 arm7_9_assert_reset(): srst resets test logic, too **** STEP 3 - Windows driver **** The application uses usbser.sys which is part of MS-Windows 2000 and MS Windows XP. Connect the evaluation-boards USB-connector with your PC. After the application has been uploaded to the controller's flash or the controller restarts Windows will detect a new USB-device and ask for a driver if it has not already been installed. Select browse for driver, other location, select the at6125_virtualcom.inf file include in the package. You need Administrator user-rights to install the driver (and only for installation, "everyone" can use later) **** STEP 4 - Test **** MS Windows will assign virtual COM-Port automaticly. Connect a "legacy"-COM port of your PC to the UART-connector of the eval.-board In my tests Windows assigned COM7 to the virtual COM-port and I connected COM2 to the UART-connector (J2) fo the eval.-board. To test the software I have used two instances of a terminal-software (Bray's terminal): one connected to COM7-the virtual USB (115200,8,n,1) the other to COM2 (115200,8,n,1). The result is shown in the screenshot (file test.png). That's it for now. Have fun, Martin Thomas

近期下载者

相关文件


收藏者