| The Datasheet Archive - 100 Million Datasheets from 7500 Manufacturers. |
David Alter ABSTRACT Efficient utilization available memory TMS320C24x
Top Searches for this datasheetUsing Access Data Stored Program Space Memory TMS320C24x David Alter ABSTRACT Efficient utilization available memory TMS320C24xDSP sometimes requires placement data program space memory opposed data space memory). particular, on-chip flash ROM) program space provides large nonvolatile memory storing constant arrays, look-up tables, string tables. However, accessing this data using programming language problematic, since C-compiler provides mechanism accessing program space. This application note presents C-callable library assembly code functions accessing data program space memory. These functions work with members C24xDSP generation, including C/F24x, LC/LF240x, LC/LF240xA devices. Note: These functions cannot used program on-chip flash memory. Programming flash requires using several different flash programming utilities. These utilities available Texas Instruments (TI) website, www.ti.com. Applications Semiconductor Group Contents Introduction.2 Code Download.3 Download Package Contents PFUNC Code Library Example PFUNC Library Use.4 Constructing Program Memory Data Values References.6 Appendix PFUNC Function Library Technical Reference.7 Tables Table Table Description Code Download Files.3 PFUNC Library Functions.3 TMS320C24x C24x trademarks Texas Instruments. Other trademarks property their respective owners. SPRA380 Introduction TMS320C24x devices, sometimes desirable place data program space memory rather than data space memory. particular, on-chip flash ROM) program space provides large nonvolatile memory storing constant arrays, look-up tables, string tables. When working programming language, however, sufficient simply link data into program space, C-compiler expects constants (and variables) data space memory. mechanism exists C-compiler accessing program space memory, other than code-initialization time. method overcoming this problem copy data from flash ROM) into data space part code-initialization process. This could done using custom assembly code routine, C-compiler does provide some built-in capability initializing global static variables constants. C-code could then access copies data data space during code execution. downside this approach that each word data consumes words memory: original data flash, copy data data space RAM. Large arrays constants string tables quickly valuable on-chip available C24x generation DSPs. better approach temporarily copy value interest from flash data only when needed time. C-code then access temporary copy (e.g., local variable located software stack), dispatch value required. This approach avoids double memory usage problem expense using some clock cycles temporarily copy data from program memory each time value accessed time. This application reports utilizes this temporary copy method, presents C-callable library assembly code functions accessing data program memory. simple C-code example illustrating their usage also provided. These functions work with members C24x generation, including C/F24x, LC/LF240x, LC/LF240xA devices. Using Access Data Stored Program Space Memory TMS320C24x SPRA380 Code Download Download Package Contents code download accompanies this application report. This download obtained from Texas Instruments website, www.ti.com. description each file download given Table Table File Name .pfunc\make.bat .\pfunc\include\pfunc.h .\pfunc\lib\pfunc.lib .\pfunc\src\blkread.asm .\pfunc\src\blkwrite.asm .\pfunc\src\strread.asm .\pfunc\src\strwrite.asm .\pfunc\src\wordread.asm .\pfunc\src\wordwrite.asm .\example\example.mak .\example\main.c .\example\table.asm .\example\lf2407a.cmd .\example\example.map .\example\example.out Description Code Download Files Description Windows batch file building PFUNC library language header file PFUNC library functions function library source file PFUNC_blkRead() function source file PFUNC_blkWrite() function source file PFUNC_strRead() function source file PFUNC_strWrite() function source file PFUNC_wordRead() function source file PFUNC_wordWrite() function C24x Code Composer v4.1x project file example main() function example assembly code data table file example TMS320LF2407A linker command file example .map file from prebuilt example prebuilt example executable PFUNC Code Library C-callable functions manipulating data stored program space memory have been hand-coded assembly language efficiency. These functions listed Table Table Function Name PFUNC_blkRead() PFUNC_blkWrite() PFUNC_strRead() PFUNC_strWrite() PFUNC_wordRead() PFUNC_wordWrite() PFUNC Library Functions Description copies block from program space data space copies block from data space program space copies string from program space data space copies string from data space program space copies word from program space data space copies word from data space program space heart each function uses TBLR TBLW assembly instruction access data program space memory. Each function described greater detail Appendix this application report. Using Access Data Stored Program Space Memory TMS320C24x SPRA380 important understand that three write functions cannot used program on-chip flash memory flash devices C24x generation. Programming flash requires using device-specific flash programming utilities. These utilities available website, www.ti.com. three data write functions listed Table mostly included library completeness. There internal program current C24x generation devices that dual-mapped into data space, unlikely that would have much write functions. only conceivable exception this would external peripheral device) were decoded only program space. facilitate incorporation into reader's application, functions have been packaged into library called pfunc.lib (PFUNC stands program memory function). reader should include this library into their Code Composer project. header file, pfunc.h, which contains function prototype each function, also been provided. This file should included C-source file function that will calling library function. libraries have been built using TMS320C2x/C2xx/C5x Code Generation Tools v7.00 (included C24x Code Composer v4.1x). Source code been provided each function should user want modify function would like basis creating functions. provided batch file make.bat used rebuild PFUNC function library from source files command prompt. usage make yourlib where "yourlib" name library wish create. author chose name pfunc.lib, name want. Alternately, simply include modified source file directly into your Code Composer project, build library all. Example PFUNC Library .\example directory contains example PFUNC function use. reality, this example does much! really there just provide illustration coding needed PFUNC functions. example LF2407 LF2407A evaluation module (EVM) with JTAG emulator attached, C24x Code Composer v4.1x running host example program, copy file .\pfunc\include\pfunc.h into .\example directory. Then, start Code Composer load file example.mak using Project->Open menu command. then build example. Using Access Data Stored Program Space Memory TMS320C24x SPRA380 When program run, Stdout window Code Composer should show following: encounter difficulties either loading project building code, most likely file path problem. prebuilt executable file .\example\example.out been provided which should produce above Stdout window when LF2407 LF2407A EVM. File->Load Program menu command Code Composer directly load this executable file, then program. Here what main() does. First, reads string1 string2 using PFUNC_strRead() PFUNC_blkRead() functions respectively, prints them both Stdout window. Next, overwrites string1 with string2, string2 with string1, using PFUNC_strWrite() PFUNC_blkwrite(), respectively. then reads both strings back prints them Stdout window. next reads single word label using PFUNC_wordRead(), prints value Stdout window. Finally, overwrites with different value using PFUNC_wordWrite(), then reads back prints Stdout window. Note that temporary arrays (e.g., tmp1[ tmp2[ must declared sufficient length hold copied program memory strings blocks. PFUNC functions cross-check source destination lengths, will overwrite other data destination length smaller than source string length block size. Also, PFUNC_blkRead() PFUNC_blkWrite() designed read blocks data type int, here they being used read strings (which blocks data type char). Therefore, typecasting been used function calls each. Constructing Program Memory Data Values program memory data values best constructed using assembly language. file table.asm shows example this. This particular example shows strings 16-bit word that stored program memory. "table" section linked program space memory linker command file lf2407a.cmd. .def directive allows named labels accessed code other source files. Additional information assembly language elements used found TMS320C1x/C2x/C2xx/C5x Assembly Language Tools User's Guide (SPRU018). Note that terminating zero been manually added strings, since termination strings trailing zero (null character) C-language convention. assembler does automatically zero. When non-string data being declared (e.g., word symbol terminating zero used. Using Access Data Stored Program Space Memory TMS320C24x SPRA380 References TMS320C2x/C2xx/C5x Optimizing Compiler User's Guide (SPRU024) TMS320F/C24x Controllers Reference Guide: Instruction (SPRU160) TMS320C1x/C2x/C2xx/C5x Assembly Language Tools User's Guide (SPRU018). Using Access Data Stored Program Space Memory TMS320C24x SPRA380 Appendix PFUNC Function Library Technical Reference PFUNC_blkRead Function Copies block words from program space data space void PFUNC_blkRead( *addrProg, *ptrData, unsigned length addrProg ptrData None Copies block 16-bit words from program space data space. This function similar PFUNC_strRead() except that PFUNC_strRead() uses terminating null character string mark block, whereas this function passes length block parameter. source block address program space pointer data space destination block Arguments Return Value Description Example #define extern addrProg; ptrData[N]; unsigned length PFUNC_blkRead(&addrProg, ptrData, length); Using Access Data Stored Program Space Memory TMS320C24x SPRA380 PFUNC_blkWrite Function Copies block words from data space program space void PFUNC_blkWrite( *addrProg, *ptrData, unsigned length addrProg ptrData None Copies block 16-bit words from data space program space RAM. This function similar PFUNC_strWrite() except that PFUNC_strWrite() uses terminating null character string mark block, whereas this function passes length block parameter. This function cannot used write on-chip flash memory. Programming flash requires using several different flash programming utilities. These utilities available website, www.ti.com. Example #define extern addrProg; ptrData[N]; unsigned length PFUNC_blkWrite(&addrProg, ptrData, length); destination block address program space pointer data space source block Arguments Return Value Description Using Access Data Stored Program Space Memory TMS320C24x SPRA380 PFUNC_strRead Function Copies string from program space data space void PFUNC_strRead( char *addrProg, char *strData, addrProg strData None Copies string from program space data space. This function similar PFUNC_blkRead except that PFUNC_blkRead passes length block parameter, whereas this function uses terminating null character string mark block. Example #define extern char addrProg; char strData[N]; PFUNC_strRead(&addrProg, strData); source string address program space pointer data space destination string Arguments Return Value Description Using Access Data Stored Program Space Memory TMS320C24x SPRA380 PFUNC_strWrite Function Copies string from data space program space void PFUNC_strWrite( char *addrProg, char *strData, addrProg strData None Copies string from data space program space. This function similar PFUNC_blkWrite except that PFUNC_blkWrite passes length block parameter, whereas this function uses terminating null character string mark block. This function cannot used write on-chip flash memory. Programming flash requires using several different flash programming utilities. These utilities available website, www.ti.com. Example #define extern char addrProg; char strData[N]; PFUNC_strWrite(&addrProg, strData); destination string address program space pointer data space source string Arguments Return Value Description Using Access Data Stored Program Space Memory TMS320C24x SPRA380 PFUNC_wordRead Function Copies word from program space data space PFUNC_wordRead( *addrProg addrProg wordData source word address program space destination word data space Arguments Return Value Description Example Copies single 16-bit word from program space data space. extern addrProg; wordData; wordData PFUNC_wordRead(&addrProg); Using Access Data Stored Program Space Memory TMS320C24x SPRA380 PFUNC_wordWrite Function Copies word from data space program space void PFUNC_wordWrite( *addrProg wordData addrProg wordData none Copies single 16-bit word from data space program space. This function cannot used write on-chip flash memory. Programming flash requires using several different flash programming utilities. These utilities available website, www.ti.com. Example extern addrProg; wordData; PFUNC_wordWrite(&addrProg, wordData); destination word address program space source word data space Arguments Return Value Description Using Access Data Stored Program Space Memory TMS320C24x IMPORTANT NOTICE Texas Instruments Incorporated subsidiaries (TI) reserve right make corrections, modifications, enhancements, improvements, other changes products services time discontinue product service without notice. Customers should obtain latest relevant information before placing orders should verify that such information current complete. products sold subject TI's terms conditions sale supplied time order acknowledgment. warrants performance hardware products specifications applicable time sale accordance with TI's standard warranty. Testing other quality control techniques used extent deems necessary support this warranty. Except where mandated government requirements, testing parameters each product necessarily performed. assumes liability applications assistance customer product design. Customers responsible their products applications using components. minimize risks associated with customer products applications, customers should provide adequate design operating safeguards. does warrant represent that license, either express implied, granted under patent right, copyright, mask work right, other intellectual property right relating combination, machine, process which products services used. Information published regarding third-party products services does constitute license from such products services warranty endorsement thereof. such information require license from third party under patents other intellectual property third party, license from under patents other intellectual property Reproduction information data books data sheets permissible only reproduction without alteration accompanied associated warranties, conditions, limitations, notices. Reproduction this information with alteration unfair deceptive business practice. responsible liable such altered documentation. Resale products services with statements different from beyond parameters stated that product service voids express implied warranties associated product service unfair deceptive business practice. responsible liable such statements. Mailing Address: Texas Instruments Post Office 655303 Dallas, Texas 75265 Copyright 2002, Texas Instruments Incorporated Other recent searchesSi7613DN - Si7613DN Si7613DN Datasheet SDNS033B - SDNS033B SDNS033B Datasheet RM3182A - RM3182A RM3182A Datasheet LM3673 - LM3673 LM3673 Datasheet HM-6617 - HM-6617 HM-6617 Datasheet EZC15DRXN - EZC15DRXN EZC15DRXN Datasheet 2N6132 - 2N6132 2N6132 Datasheet 2N6133 - 2N6133 2N6133 Datasheet 2N6134 - 2N6134 2N6134 Datasheet
Privacy Policy | Disclaimer |