资源预览内容
第1页 / 共36页
第2页 / 共36页
第3页 / 共36页
第4页 / 共36页
第5页 / 共36页
第6页 / 共36页
第7页 / 共36页
第8页 / 共36页
第9页 / 共36页
第10页 / 共36页
亲,该文档总共36页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
STM8 开发环境建立,http:/www.foryouge.com,STM8 开发环境建立,STM8处理器特点,通用特点 Max fCPU: Up to 24 MHz。 1.6 cycles/instruction。 up to 128 Kbytes Flash。 up to 2 Kbytes true data EPROM。 up to 6 Kbytes。 Up to 70 user I/Os。,STM8处理器特点,CAN 控制器特点 High speed 1 Mbit/s active CAN 2.0B interface。 3 transmit mailboxes。 1 receive FIFO with three stages。 6 scalable filter banks。 Time Stamp on SOF reception and transmission。 Error management。,STM8处理器特点,MEMORY MAP,开发工具,软件: 编译器:CXSTM8(cpstm8, cgstm8, costm8, castm8) 连接器:CLNK 编程支持工具:chex,clabs,clib,cobj,cv695,cvdwarf 调试器:ST Visual Develop 编程器:ST Visual Programmer 硬件: 仿真器Rlink 仿真器STICE,CXSTM8,Compiler Architecture(CXSTM8): cpstm8:the C preprocessor and language parser. cpstm8 expands directives in your C source and parses the resulting text. cgstm8 - the code generator. cgstm8 accepts the output of cpstm8 and generates assembly language statements.,CXSTM8,costm8 - the assembly language optimizer. costm8 optimizes the assembly language code that cgstm8 generates. castm8 - the assembler. castm8 converts the assembly language output of costm8 to a relocatable object module.,CLNK,CLINK clnk combines all the object modules that make the appropriate modules from the C library.,PROGRAMMING,编程支持工具: chex - absolute hex file generator. clabs - absolute listing utility. clib - build and maintain object module libraries. cobj - object module inspector. cv695 - IEEE695 format converter. cvdwarf - ELF/DWARF format converter.,COMPILER,File Naming Conventions,COMPILER,Memory Models Zero Page:0x000xff, more efficient than Long Range variables. long range:0x10017ff。,COMPILER,Step 1: Compiling cxstm8 options .c|s Step 2: Linking clnk options Step 3: Generating hex file chex options file Step 4: Generating updata file,COMPILER,BUILD.BAT cxstm8 options: -l :create listing +debug :produce debug information +modsl :select the Stack Long mode. +warn :enable warnings. +strict :enforce stronger type checking.,COMPILER,ce*:specify a path for the error files. -e :log errors file. t* :specify path for temporary files. -co*:specify a path for the object files.,CLNK,Clnk option: -bs# :bank size -m* :map file name -o* :output file name -sa :sort symbol by address,CLNK,SV64E0_M8.lkf +seg -a* :make the current segment follow the segment * -b* :set the physical start address of the segment to * -ic: mark this segment as moveable segment -m*:set the maximum size of the segment to * bytes.,CLNK,-n:set the output name of the segment to *.,CLNK,Segment type: .text:code (or program) section .fconst:large constant and literal data .const:constant and literal data .data:initialized data in long addressing range memory .bss:all non initialized data in long range memory,CLNK,.bsct:initialized data in the first 256 bytes .ubsct:non initialized data in the zero page .fdata:large variables .eeprom:any variable in eeprom .bit:bit variables in the zero page,Runtime Startup,Runtime Startup(crtsxf.s): Establish a runtime environment for C. Include: Initialization of the data section if any, ROM into RAM copy if required, Initialization of the stack pointer, main or other program entry point call, An exit sequence to return from the C environment.,Runtime Startup,ROM COPY TO RAM Automatic Data Initialization Moveable Code,Runtime Startup,Automatic Data Initialization The linker is able to configure the executable for an automatic data initialization.This mechanism is initiated automatically when the linker finds the symbol _idesc_ in the symbol table.,Runtime Startup,Moveable Code The linker allows a code segment to be stored in the ROM part, but linked at another address which is supposed to be located in RAM. This feature is specially designed to allow an application to run FLASH programming routines or bootloader from the RAM space.,Runtime Startup,Descriptor:The starting address and length of each segment to be copyed to RAM. Format: dc.w start_prom_address; dc.b flag ; segment type dc.w start_ram_address dc.w end_prom_address dc.b 0 ;end of the descriptor,Runtime Startup,_idesc_:The address of the descriptor, built by clnk 。,clabs,clabs options file -v :be verbose. The name of each module of the application is output to STDOUT.,chex,chex options inputfile outfile -f? :define output file format. Default -fm,cvdwarf,cvdwarf options inputfile -o* :output file name,DEBUG,Debug 1.Run ST Visual Develop. 2.File| New Workspace,Select Wrap Executable.Select SV64E0.elf.,DEBUG,3.Enter ok!,DEBUG,4.Select MCU STM8AF51AA.,DEBUG,5. Insert files into project. Project | Insert files into project. Select all the *.c , *.h *.s files of the project in the open window.,DEBUG,6.Select the emluator. By pressing Debug instrument | Target Settings.The dialog for choose the emulutor will be opened.,DEBUG,.Select Swim Rlink for the Rlink emluator. .Select Swim STice for the STice emluator. .Target Port Selection: usb:/usb,DEBUG,7 .Start Debug. By pressing Debug | Start
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号