Home

SDK C User Guide

image

Contents

1. 1 is held APP1 YourApp The application launched when key 2 is held APP2 AnotherApp The application launched when key 3 is held APP3 YetAnotherApp The application launched when key 4 is held APP4 The application launched when key 5 is held APP5 Note that the only app that has to be present is APP1 the others are all optional There is an example settings sh file in the SDKC_ROOT SDK Target examples settings folder for you to copy and modify IMPORTANT NOTE The settings sh file MUST be a Linux compatible file with Linux line endings DOS files have a carriage return line feed CR LF OXOD 0x0A at the end of each line Linux files just have a line feed LF Ox0A at the end of each line Creating a Splash Screen Bitmap You also need to create a splash screen bitmap which will be displayed while the target unit is booting The splash screen must be called splashscreen bmp case sensitive and must be placed in the rootfs app bin folder located under your project folder There is an example splashscreen bmp file in the SDKC_ROOT Target examples splashscreen folder for you to copy and modify Target Update Packages There are two methods of updating the target hardware units these are as follows e Manufacturing Tool This method completely updates everything in the Target including the boot loader OS root file system and your app This method is recommend during production as this guarantees the correct ve
2. EA SARARAN 10 Hiero 11 compiling and Runnihg estie esee p roro aaea EUR UNS ERES Ra eR RR ghee Sakae BURNER FERREA ERE YEAH ERE ER UR TR RR MEE 11 Heo H H METERE 11 SIMON t 11 CAN tilo ado 11 Page 1 SDK C User Guide Version 1 40 The Target HardWat68 2 deett start rea die cance eese Du aaaea iaaa aaaea Aaaa a Raa eni ai daa aaaea iei 13 Comipiling 5 2 2 12 trot Enea edente cdi dadden ois ERR Ree Ia Cu Pede e aee cari gad a Ua o Qe Re oco dee e EET indi 13 Creating a Settings Script riii niii noce ei TE eR ERR ME e ERR Ere Deb e ERES Ea aaa aa TRA ERE S e SEES RSS E TRO ERG 13 Creating a Splash Screen Bitmap ccccccssssccssssccccssssseccessseeeceseeseecsseeaececcsaeeeeesceeaeeeeeesaueeeeseensenes 14 Target Update Packages innert diia 14 Building the Target Update Packages cccssssccsssssecccccsseeeesseeeeeeceseecccesseeeceseeeeeecessaeeeeeseeseeens 14 Manufacturing Tool Full Update ccooconooocccononcnonanononnnnnnonononncnonoconnnnnonnnnononnncnnnnnnnnncnnnnonnnncnns 15 USB Stick App Updates 25 2i e tamea a chance S PROS DEA CA doe T CER ee bae Re TENER DON 16 Utilities 1 05 oret AAE T ee e ee SEE IE Ete dee desit e ere e eve ae tre e IR E ORC 17 Bitiriap ConversloD cedet oett desee A A baaa 17 CAN Log Converters a aene ion
3. and other tools required to build SDK apps e aunchEcClipse bat Special batch file that MUST be used to launch the Eclipse environment when building executable for the target hardware SDKC ROOT SDK Folder The SDKC ROOT SDK folder contains the following Docs Folder This folder contains all of the documentation for the SDK including this document Platforms Folder This folder contains the libraries and header files that are platform dependent Portable Folder This folder contains the libraries and header files that are not platform dependent Projects Folder This folder is where your projects are stored You should only be editing files under this folder Please see the Starter Project section for details of what is in the project ProjectSamples Folder This folder contains sample projects for your reference Do NOT edit the sample projects in here use the Create Project Wizard to copy them into your Projects folder where you can freely edit and customise them ProjectTemplates Folder This folder contains starting templates for your projects Do NOT edit the templates projects in here use the Create Project Wizard to copy them into your Projects folder where you can freely edit and customise them Scripts Folder This folder contains various scripts such as the Create Project and Build Update Wizards Target Folder The folder contains target hardware specific items such as the Manufacturing Tool target specific scripts a
4. folder to the previously blank memory stick Please note that you should only copy the files from the usbupdate folder to the root of the USB Stick not the usbupdate folder itself Power up the Target hardware and wait for the installed app to run then plug the USB stick into the rear USB connector The USB Stick will be automatically detected the update will begin Once the update has finished the backlight will flash on and off to indicate the process is complete You should then remove the USB Stick and the unit will reboot The unit will now be updated with your latest apps and by default will run APP1 Use the key hold mechanism while booting to choose an alternative app if required SDK C User Guide Version 1 40 Page 16 Utilities Bitmap Conversion The Bitmap Conversion too called BitmapTool exe and located under SDKC_ROOT SDK Utilities is used to convert bitmaps for use within projects All apps require c and h files to allow bitmaps to be displayed The user has to edit data c disp_ext c and data h images h and add the new c and h files for them to be used in a project Please ask for information on how to add and use alternative true type fonts CAN Log Converter The CAN Log Converter called ctlogcvt exe and located under SDKC_ROOT SDK Utilities is used to convert different CAN logs to different format Currently CANtronik Binary CTB PCAN and CANalyzer formats are supported Please run the program from t
5. possible to take into account every possibility of the users app programming style or structure of existing apps written using a source code SDK So while the code generated by the tool should be a drop in and compile solution for typical projects introduction of the auto generated language source code files to some existing apps may present compilation or link issues that will need to be manually resolved this is beyond the scope of this guide Prerequisites To use the Language Table spreadsheet you will need to have Microsoft Office Excel 2003 or later Capabilities String data words phrases in any language which can be written using characters lying within the Basic Multilingual Plane BMP of the Unicode standard can be entered and will be encoded by the tool The tool can handle string data for up to 23 languages one per column starting in column C Note that the language order in the sheet will normally define the language order presented in the language selection menu in your app The language list will be terminated by a column having no language name entry in its Row19 cell To make efficient use of memory in the target system the C source code generated by the tool assigns each string s data as an individual string constant The phrase by language array s generated are then 2D array s of pointers to the discrete phrase word data string constants The tool will process and encode up to 30 arrays groupings of s
6. section are also tfonts lt included in the Eclipse project used when building the App for the Target uart c uartviewer c A Headers a y PCSIM PCInterface cpp C PCMain cpp PCPlatformSim c PCUART cpp data Folder This folder contains the bitmaps and fonts that are used within the project They are included in the project using the data c h modules You need to use the BitmapTool to convert bitmaps for use in the projects see the Bitmap Conversion section for more information on the BitmapTool source Folder This folder contains the main source code for the project e can c h support for the CAN Ports e canviewer c h for viewing and recording raw CAN frames Accessed from the Diagnostics menu e data c h contains the constant data used for the font and bitmap data also data h the data files are in the data folder sub folders e eventhandler c h support for handling events from OS scripts e o board user c h support code for the integrated I O sub system e Janguage c h inc contains the string data used for the text data Please see the Multi Language Support section for more information on language support e main c h contains the main loop and also timer call back routines e menu c h example menu screens accessed by pressing and holding key 5 e mmi c h functions to control the screen and keys not usually modified e screens c h the u
7. KC ROOT SDK ProjectSamples folder Once you have selected the source project type you will be asked to select the source project to copy from You will then be asked to enter a name for the new project After confirming your choices your new project will be created under the SDKC ROOT SDK Projects folder Page 7 SDK C User Guide Version 1 40 Starter Project Template Overview This section describes the layout of the Starter template project This is the project that we recommend you use to base your own projects on Use the Create Project Wizard to create a copy of itinto the SDKC_ROOT SDK Projects folder for you to work on File Folder Layout The top level project folder contains the Visual C 2010 sIn and amp vcxproj and Eclipse project and cproject project workspace files together with a few sub folders TI Solution Starter 1 project 4 7 Starter gl External Dependencies Gi Resource Files A 4 Ez Source Files This screenshot from Visual C 2010 shows the C modules used in the project 4 WA ads C canviewer c data c The project consists of the App source files c and h files inthe App and eventhandler c E amp jiebedwec Headers section and the PC Simulator files in the PCSIM section You should language c a only modify the files in the App and Header sections amp mmic 4 screens c 3 i sdk init The same source files apart from the ones in the PCSIM
8. SDK C User Guide V1 40 Table of Contents O NN 3 A NN 4 Installing Visual C 2010 Express ccscceccssssecccsssssececeseeeceesseeeceseeeececcssaseecesseeaeeeecseuaeeeesseeseeseseeeeess 4 Installing SDK Cai a ai Abd 4 CAN ECT COs css A cade 5 Other Installation A A a An Acad da 5 SDK Folder Cayo ii as diria 6 SDKC ROOT SDK Eolo id 6 Docs FM ci 6 Plattorms Folder iii E 6 ll O 6 Projects Eolo 6 ProjectSamples Folder casi eens aa aa Eaa GENER R ER NARRA X RAE deeded 6 ProjectTemplates Folder tases ste eee Ges an eR A RU RR UEBER Ce RARE EMEN eis 6 Scripts Folder tare eri caza a ERR AREE Re dO ER REN ELEM AE 6 Uc ipe 6 E ig seated 6 Creating a Project with the Create Project Wizard eene enne en nnne nennen 7 Starter Project Template Overview ccccscccccssssssecessseeecsssesecseseeaeceeesaseeeseseeeaeceeesaseeeeseseeeccesaaeeceneneas 8 File FolderEayOUEs ees te SP E Ot o ta dee do 8 eruere 8 fepee Aznlge e 8 rootfs Folders 9 SETAS mE P 9 CAN COMMUNICATIONS husillo 9 UART COMMUNICATIONS 133 5 preter tope ii a dia da 10 Input Output SUPPOFT esis ec cccccccssccseccsseecseecesecessessscsseccsecssecesecessecsssessecssesesssessecssecesscesseeaeseasesaseeaes 10 Norn Volatile Storage ater eR GREG OR NER RARO RR RR
9. al Studio 2010 as the IDE The Express Free versions or the full versions can be used Once the app has been developed and tested on the PC the Development Environment used for building the same app that will run on the target is the well known Eclipse IDE coupled with the Sourcery Codebench ARM compiler from Mentor Graphics Page 3 SDK C User Guide Version 1 40 Installation To assist installation we have created a single zip file and supporting batch files Please follow the steps below Installing Visual C 2010 Express If you already have an installed Visual C 2010 then you can skip this section 1 Download Visual C 2010 Express from here http www microsoft com visualstudio en us products 2010 editions visual cpp express 2 Follow the instructions from Microsoft to install Installing SDK C 1 Download SDKC Toolchain zip file from here http www cradl co uk files SDKC Toolchain zip The file is around 200MB and should take 10 minutes to download 2 Create the root folder under which all the SDK files will be located For example this may be D SDKC as used in this installation guide Please note that in all further documentation this SDK root folder will be referred to as SDKC ROOT for simplicity IMPORTANT NOTE You MUST not have any spaces in any of the folder names above or below the SDKC ROOT folder as this will cause the SDK to not function correctly 3 Extract the SDKC Toolchain zip file into
10. d string constants data A feature of this file is the comments following string consts that contain characters of a codepoint above 127 These comments when present show the codepoint in U nnnn form for these characters Characters up to codepoint 127 in that string will be represented by a dot The figure below illustrates this gt PSPad language inc Mi x46 x52 x 41V x 4EV X43 x 41V x 49 x 53 Ax44 x45 x 553 x54 x53 x 43V x 48 Ax49Vx54V x41 x 4CV x 493 x 41V x 4AEV x AF AX4EVX45Xx44V x 45 x 523 x4CV x 41V x 4EV x 44 x53 M xSO x4F x52 x54 x55 x 47 x 553 x45 x53 const unsigned char cucSystemWords 00001 004 const unsigned char cucSystemWords 00001 005 const unsigned char cucSystemWords 00001 O06 const unsigned char cucSystemWords 00001 O07 const unsigned char cucSystemWords 00001 OO8 2 File Projects Edit Search View Format Tools Scripts HTML Settings Window Help x m O 92 ies EA see GEG O ec B Geipsgnvgd sAas lt HT Eile il wr a FE MAALI SELG 1 language inc 10 20 30 40 50 60 70 80 30 100 ARA EE E AA RO A retener erts ASE Al ASIA AAA EEE war tere Ter te Ge Wer verted DPS fod cy dor fe PRO Be fer ERA INCISO fea or var erie erem 7 wLANG const unsigned char cucSystemWords 00001 OO0 x45 x4E x47 x4CV x49 x53 x48 const unsigned char cucSystemWords 00001 OO1 x45 x53 x50 x41 xC3 x91 x4F x 4C AF acusa OO Loi const unsigned char cucSystemWords 00001 O02
11. d to the name For example if your project was called Test the Debug build would produce an executable file called Test Debug whereas the Release build would produce an executable with no extension called Test All executable are copied to the rootfs app bin project sub folder Creating a Settings Script Each Target unit has the capability of auto launching one of up to five apps stored on the internal NAND flash Each app must have a unique file name and each app will have its own independent configuration file that is used to store non volatile settings simulates an EEPROM to store configuration and settings data The selection of which app to run is made by holding down one of the 5 keys during the boot up sequence while the splash screen is shown before an app starts Once an app has been selected this app then auto launches during subsequent boot ups unless another key is held to select an alternative app This feature allows one standard display to be configured to have alternative features depending on which app is currently active This may also be used to access built in test functionality or product information in place of a user manual Page 13 SDK C User Guide Version 1 40 To control which apps are launched you need to create a settings sh case sensitive file in the rootfs app bin folder located under your project folder which needs to look something like the following bin sh The application launched when key
12. ds 3 For each other language enter translations of each phrase word For this example the writer used http translate google co uk to obtain translations of the example words phrases 4 When your language table is populated you need to put some entries in the Red Zone these will help to map your phrases words to labels that you can reference them within your app code i Firstly we need to name the array that the strings will be accessed through in the app code In this example this is cucSystemWords This must be followed in the cell below by a symbol ii Each row containing a phrase word must have a label in the Red Zone these label words are the labels your app code will use to access the string data for example wLANG wLANGUAGE wCONFIGMNU wBEEP etc iii An extra label after the last phrase word in the group is added e g w SIZE This serves to dimension the storage array in the generated language source code for your app Page 20 SDK C User Guide Version 1 40 iv The Red Zone cell below the last phrase word entry of the current group e g cucSystem Words in this example must be contain 5 If your app requires it there can be additional groups of words each group bounded and labelled as described in 4i to 4iv above The figure below shows one language and associated RedZone content Enalish UK Language Gallon US Gallon Colour Bonnet Boot Beep Config Menu On Off Enable Disab
13. e da Te UR Regni ege sued ve Eye Tha Enea pute of Ree oen Don 17 MultiLanguage SuppoEts sco eiiis te es oct deo add Yu Exe ae quunt ete o ea Eee ege Ran 18 Prerrequisito tese ete nee qa rn eee seu ee ree Tende 18 Capabilities 5 52 A Pea Een pat ee ten SR RE NV La dba O aaa aiaiai Sie 18 Topology of the tool a tette e tere eite ea eh Secs a ee Rear du ide 18 Using the Spreadsheets 2 1 urs dada 20 Generating Source Code sese deoa naa dual ERN Ra dea decina qe eae eg Tae eat 21 Qutpult files oct emt Lett ete eee te uet die enr due Pe Ite al od A O 22 Language InC A 22 Font CUSTOMISATION itor da ei T xen extet ET Re ne Diy ba da Tea deve gan gn Rast o chia I na Tea Te ER eaae eph at one Dean 22 Hardware Specification s ic mee eese A Ne ette ee o da 24 Connector Pinout Cable Harness cococcccnnnonccccnnnnncncnanannnanannnnnanonan cnc conan cnn cnnnn no conc nana nn cnn nano na desea nn nc seen n a 25 Cable iii teer ate de A A a 25 Cl iii AA A 25 Page 2 SDK C User Guide Version 1 40 Overview The development environment consists of two modes one is when using the PC simulator to develop and test apps and the other is used to build the binary files that run on the target platform The fastest approach for developing apps is to use the PC Simulator The PC Simulator allows the use of the one or two CAN Interfaces CANdo or Kvaser supported so the apps get access to live CAN bus The PC Development Environment uses Microsoft Visu
14. e same name as your project and click the start button The green Start button will change to a red Stop button and Page 15 SDK C User Guide Version 1 40 the update procedure will begin After approximately 40 seconds Complete should appear as follows the message Operations r o o I dm dih MfgToo w Sex File Options Help A Hub 8 Port 3 B Unassigned C Unassigned D Unassigned Drive s Operations Complete Status Information v1 6 2 048 CANtronik Profile MX28 Release12 13 20120220 UT SENT Started Mon Feb 20 15 32 00 2012 Successful Operations 2 Status No USB ports selected Elapsed 0 01 16 Failed Operations 0 Version Average Duration 0 00 37 Failure Rate 0 Ready The update procedure is now complete and you may close the MfgTool and un plug the unit from the USB port and turn of the power If you used the MX28_Release13 13 profile there is only a test app installed on the device You may now put your app on the device by using the USB Stick Update procedure If you used the profile with the same name as your project then your app will already be installed and you do not need to use the USB Stick Update procedure USB Stick App Update You will need a standard USB memory stick formatted with the FAT32 file system perform this type of update Insert the memory stick into your PC and copy the contents of the usbupdate folder located under your project
15. ect with the Create Project Wizard load Visual C 2010 and follow these steps 1 Open the project by selecting File gt Open gt Project Solution from the menu Browse to the SDKC_ROOT SDK Projects YourProjectName folder and double click the YouProjectName vcxproj file to open it 3 Build the project by selecting Debug gt Build Solution from the menu Run the project in the debugger by selecting Debug gt Start Debugging from the menu The PC Simulator will run and you will see something like this CANvu 355 CANbus Instrumentation 320x240 with up to 18BPP Color Super Bright 750 NIT Back light Fully Scalable TrueType Fonts djust backlight Press Key 5 to ai Hold down Key 5 to enter menu screens LCD The Simulator provides a one to one mapping of the hardware LCD pixels to PC screen pixels This means that the simulator provides an accurate representation of the LCD with no spurious artefacts or distortions For this reason the zoom factors are limited to whole numbers 1 1 1 2 and 1 4 At the 1 1 setting the pixels are one to one so the LCD window occupies 320 pixels in the X direction by 240 pixels in the Y direction matching the hardware LCD exactly At the 1 2 setting each LCD pixel is expanded to 2 pixels in the X direction amp 2 pixels in the Y direction hence each pixel occupies 4 pixels on the PC screen At the 1 4 setting each LCD pixel is expanded to 4 pixels in the X direction amp 4 pixels in the Y direction he
16. font If they aren t then we may make the decision to add them creating a custom font based on Arial for the project The Character Map tool in Microsoft Windows will enable us to look for characters within fonts that are on windows but with a font editor it would be better to open the arial ttf file that we are using for sake of example for the app using the font editor to look inside it With can see that the character of codepoint U D1 is the N character as in ESPA OL and that it is available in Arial font The character of codepoint U 4E2D is the Chinese ideogram H The simsun ttf font contains a good many Eastern Asian characters ideograms so knowing the codepoint we can open simsun ttf in a font editor and look for it at codepoint U 4E2D within the font The character of codepoint U 6587 is the Chinese ideogram X The simsun ttf font contains a good many Eastern Asian characters ideograms so knowing the codepoint we can open simsun ttf in a font editor and look for it at codepoint U 6587 within the font The font editor can then be used to add a new glyph to a base font for each of the glyph characters that we need and have found in simsun ttf Example steps e Take a copy of arial ttf and rename it charial ttf or whatever you want to call your customised font e Open charial ttf with the font editor Open simsun ttf with the font editor e Within the charial font navigate to the end of the font and in
17. he Command Prompt The command line parameters are as follows CTLOGCVT v2 01 Copyright e 2011 CANtronik Ltd usage ctlogcvt input type input_filename ext output type output filename ext input type and output type can be one of the following cantronik CANtronik binary format ctb canalyzer Vector CANalyzer format asc pcan Peak PCAN Explorer format trc Page 17 SDK C User Guide Version 1 40 Multi Language Support The language spreadsheet is to be found in the SDKC_ROOT SDK Utilities folder it is called Language_Table xls It is also used in the all the starter template projects and is located under their source folders The spreadsheet is a development tool it can process app text phrases and words entered in cells in the spreadsheet and generate the language source files for the project Benefits of language source files generated from the spreadsheet tool are e Provides a convenient method of editing app text in a syntax free environment e No C programming knowledge needed so is ideal for use by linguists translators e Additional language provision in app just requires new columns in the table and translations to enter in the table e When your app makes use of the FreeType library capabilities of the SDK the table s code generation handles appropriate encoding of special characters in the text data Note In producing a code generation tool like the CANvuSDKC Language Table xls it is not
18. inout Cable Harness Cable 1 PIN Wire Colour Signal Name GND PWR RAI a voem gu CANZ_GND f PNK CAN2_PWR CAN2 H s Bur CITO fa vewow TE RUM CANIL Cable 2 PIN Wire Colour Signal Name a Jonne ana f oa o s Pink oem a Jewe oem Page 25 SDK C User Guide Version 1 40
19. laces J SDKToolchain 01 04 2012 11 37 File folder LaunchEclipse bat 01 04 2012 11 37 Windows Bat 1 KB gt BE Desktop i k 4 items CAN Interfaces The PC Simulator supports either the CANdo or Kvaser CAN interfaces For CANdo support please download and install the drivers from http www cananalyser co uk For Kvaser support please download and install the drivers from http www kvaser com Other Installation The BitmapTool exe tool located under SDKC ROOT SDK Utilities requires the Microsoft NET Framework Version 2 0 Redistributable Package this appears to be included by default in Windows Vista and Windows 7 but not with Windows XP To allow the tool to run on XP there is a download available from Microsoft here http www microsoft com download en details aspx id 19 After installing this it is also necessary to do a check for updates which then installs an update If you wish to run the PC Simulator on another machine which has not had Visual C 2010 installed on it you will need to download the Microsoft Visual C 2010 Redistributable Package x86 from here http www microsoft com download en details aspx id 5555 Page 5 SDK C User Guide Version 1 40 SDK Folder Layout The root level of the SDK folder tree from here on referred to as SDKC_ROOT contains the following e Packages contains the packages used to install the SDK e SDK The main SDK source folder e SDKToolchain Toolchain
20. le Language Select Reset All Generating source code When you have completed your phrase word entry in the sheet and have satisfied the requirements of the Red Zone described above then you are ready to generate the source code to add to your app For normal usage ensure that you have selected Using UTF8 Strings in the light green cell below the Click here button Click on the Click here to generate C source code button The sheet will be processed and the output files will be generated The files will be in the same folder as the spreadsheet file was opened from They will need to be moved to the source subfolder of your project if you didn t run the spreadsheet in that location Processed string data is encoded as UTF8 byte data in the generated C source code when using the normal Using UTF8 Strings mode If the Using ASCII Strings mode is selected the processed string data will be encoded as byte data in the generated C source code In this mode any characters of codepoint greater than 127 will be Page 21 SDK C User Guide Version 1 40 encoded as a question mark character You will get a warning dialog if this occurs and the first cell found to contain an out of range character will be set active Output files The tool will normally generate the following files e Language h e Language c e Language inc included by language c Language inc Language inc contains the encode
21. nce each pixel occupies 16 pixels on the PC screen Save Screen The Simulator allows the screen to be frozen amp saved to a bitmap file This is useful during graphics development as it allows screen bitmaps to be simultaneously compared in a bitmap editor The screen bitmaps can also be useful for documentation purposes To save the current screen select File gt Save Screen and specify a location and filename in the dialog box that appears The bitmap is a one to one representation of the simulator LCD screen so if the 1 2 zoom factor is selected then the bitmap will be twice the width amp twice the height of the hardware LCD CAN The CAN ports are simulated with one of the following options Page 11 SDK C User Guide Version 1 40 e CANdo USB CAN Interface e Kvaser CAN Interface e ACAN log file To select the driver use the can_select_driver function as seen in the Starter projects can c CANInit function All the other CAN functions will now be directed through this driver UART The UART serial port is also simulated by using a COM port on the PC By default this feature is turned off but may be enabled by selecting Port gt UART from the simulator menu amp selecting the required COM port and clicking Open Port Please note that the baud rate and other parameters of the COM port are set from the parameters used in the source code Page 12 SDK C User Guide Version 1 40 The Target Hard
22. nd root file system libraries Utilities Folder This folder contains various useful utilities such as the bitmap and log converters Page 6 SDK C User Guide Version 1 40 Creating a Project with the Create Project Wizard Projects for you to work on are located under the SDKC_ROOT SDK Projects folder Initially this folder is empty you will need to create a new project using the Create Project Wizard All projects created by this wizard will be placed under the SDKC_ROOT SDK Projects folder IMPORTANT NOTE You should ONLY edit projects contained under the SDKC_ROOT SDK Projects folder DO NOT edit projects under the SDKC ROOT SDK ProjectTemplates or SDKC ROOT SDK ProjectSamples folders Use the Create Project Wizard to create a copy of a template or sample under the SDKC ROOT SDK Projects folder To create an SDK C project run the Create Project Wizard CreateProject bat file located under the SDKC ROOT SDK Scripts folder This will ask you to select the type of project you wish to create a new project from The options are 1 Anexisting project This allows you to create a new project from one of your existing projects located under the SDKC ROOT SDK Projects folder 2 Atemplate project This allows you to create a new project from one of the template projects located under the SDKC ROOT SDK ProjectTemplates folder 3 Asample project This allows you to create a new project from one of the sample projects located under the SD
23. op about 40 frames per second This needs to be erased before redrawing and should be drawn in layer 2 To create bitmaps you need to do the following e Draw the bitmap in a suitable graphics package save as 24 bit per pixel image BMP e Use the BitmapTool exe located in SDKC ROOT SDK Utilities to convert the bitmap to source code e Copy the c and h files to the data Folder in you project e Edit data c and data h to add an entry in each for the new files added to the data folder e Inthe code use the outimage function to position and draw the bitmap on the screen To draw text to the screen e Use outtextxy or outnumxy both draw in the selected colour To draw graphics primitives to the screen e Use any of the standard graphic primitives contained in SysLib CAN Communications CAN port communications are handled in can c h Page 9 SDK C User Guide Version 1 40 e Set up the CAN ports in the CANInit function e Toreceive CAN frames add support code in CANDecodeRxStd and CANDecodeRxExt e Totransmit CAN frames use the CANSend function Use the CANIDEXT_CREATE macro in can h to create an extended 29 bit CAN Id UART Communications UART communications are handled in uart c h e Set up port in the UARTInit function e Modify the low level receiver if required This is used to detect the start and end of a message e To transmit use UARTSend function Input Output Support I O suppor
24. rsion of the boot loader OS and root file system are programmed into the NAND flash along with your app e USB Stick This method ONLY updates your app the splash screen and any associated files it DOES NOT update the boot loader OS and root file system This method is recommended to update target units during development and when they are in the field Building the Target Update Packages To update the target unit you need to build the Manufacturing Tool update packages This is done by running the Build Update Wizard called BuildUpdate bat under the SDKC_ROOT SDK Scripts folder The Wizard will ask you which project you wish to create the update for before creating both Page 14 SDK C User Guide Version 1 40 a new Manufacturing Tool Profile and a USB Stick Update Once the updates are built it will also tell you how much space you have used out of the total amount of space available for apps Manufacturing Tool Full Update The Manufacturing Tool is located under the SDKC_ROOT SDK Target mfgtool folder it is called MfgTool exe When you run it you will see the following screen g Y r dh MfgToo TRE File Options Help A Unassigned B Unassigned C Unassigned D Unassigned Status Information v1 6 2 048 CANtronik Profile MX28 Release 12 13 20120220 v d Started Successful Operations Scan devices Status No USB ports selected Elapsed Failed Operations Version Average D
25. ser screens are defined here e sdk init c h contains the start up and system initialise code e settings c h has the settings structure that is saved to the EEPROM Page 8 SDK C User Guide Version 1 40 e ttfonts c h support for handling True Type Fonts e uart c h support for the UART Port e uartviewer c h for viewing raw UART data Accessed from the Diagnostics menu rootfs Folder gt rootfs PES The rootfs folder is an emulation of the part of the iis S ii Linux root file system on the Target that is i accessible by the App data P config It is created by either running the PC Simulator or gt log building the Target executable with the Eclipse IDE gt event gt media Its structure is shown in the figure opposite Screens The screen handling and drawing functions are located are screens c h Key functions are defined in ScreenEnter usually default key settings are loaded first followed by the particular requirement for the keys The keys can have text or a bitmap image on them The screen background image text is drawn in ScreenCreate this is the fixed part of the screen contents and is drawn in layer 1 This function is only called when the screen is initially displayed or when a complete screen redraw is required by setting the FLAG_UpdateScreen variable to SET The foreground changing part of the screen image text is drawn in ScreenUpdate and is drawn every lo
26. sert add two new glyphs e Within the simsun ttf font navigate to the glyph at codepoint U 4E2D select it and copy it e g Ctrl C e Within the charial font navigate to the first of the empty glyphs that you added select it and Paste e g Ctrl V the glyph copied from simsun into it e Repeat this for the glyph at U 6587 codepoint e You may quite have to manually set the codepoint mapping of these new glyphs within the charial font as the editor may not have tranfered the mapping property of the glyphs with the glyphs themselves e Save the charial font as charial ttf from the editor You d now have a custom font file charial ttf which has all the original characters of arial ttf and also has the two Chinese ideograms that you added from the simsun font With charial selected as current font in your app you would be able to display HT by out text ing the cucSystemWords 00001 003 string or more conveniently cucSystemWords wLANG SelectedLanguage Page 23 SDK C User Guide Version 1 40 Hardware Specification Item Description CPU Freescale i MX 286 running at 454 MHz NAND FLASH 128MB SDRAM 128MB DISPLAY QVGA TFT 320 x 240 with Backlight USB Dual Mode Host Device USB RS232 1 port RS485 None CAN2 0B 2 ports one isolated Buzzer 1 Keypad 5 keys with Backlight Power 10 36VDC with protection SDK C User Guide Version 1 40 Page 24 Connector P
27. sor zone light orange Page 19 SDK C User Guide Version 1 40 This area not shown in Error Reference source not found may be used to provision for conditionally compiled code in your app e g for excluding or including phrases in the build of your project according to product build variant Normally this area would be left blank Using the Spreadsheet Your product requirements document or your project plan will probably set out the language requirements for your app Usage is probably best described by example We will consider here that you decide to start with a blank table i e no phrases words entered This would be like having selected cells C20 K119 and cleared the cell contents and also clearing row C19 K19 of language names This example usage assumes English as the default language We ll have the following words available for the app Gallon GallonUS Hood Trunk Beep Config Menu On Off Enable Disable Language Select Reset All We ll build the table to provide support for English English US Russian Chinese Simplified 1 Add along row 19 starting at C19 the languages that you are going to support in your product In the accompanying example we will enter English UK in C19 English US in D19 Russian in E19 Chinese Simplified in E20 2 Add the phrases words of your default language one per cell in its language column Leave two blank cells above the first of your phrases wor
28. t is handled in io board user c h e Configure inputs using blO User Init e vSamplelOBoardInputSignals is called every loop and polls the inputs and here is where the calibration is placed e To output a signal use bSetlODigOutput Non Volatile Storage Data can be stored in non volatile storage in the Target unit this is achieved with an EEPROM emulated by a file stored in the NAND Flash The EEPROM system is controlled by two SysLib functions Restore eeprom and Store eeprom In the Starter project the gpSettings structure is saved in EEPROM see settings c h The Restore eeprom function will load the data and check the CRC if the CRC fails it will call load eeprom defaults in your app code to set up the structure with default values The Store eeprom function which should be called every main loop from CANvuMainLoop will only try and save the data if the gucStoreEepromRequired global flag variable is set to SET or a non zero value If this variable is not set it will do nothing If this variable is set it will calculate a CRC checksum of the data and if the CRC does not match the data will be saved It will always clear the gucStoreEepromRequired to zero In the Starter project the vOneMinute timer function sets this flag so that any changes to settings data are saved at a minimum period of 1 minute Page 10 SDK C User Guide Version 1 40 The PC Simulator Compiling and Running Once you have created a proj
29. the SDKC ROOT folder You should then see two new sub folders SDKToolchain and Packages in your SDKC ROOT folder as shown below m y Computer DATA D SDKC y 4 Search SDKC P w P File Edit View Tools Help Organize v Include in library v Share with v Burn New folder EH cales Name i Date modified Type Size Total size Space free d Downloads Ji Packages 2011 21 12 File folder J Dropbox J SDKToolchain 2011 20 57 File folder E Recent Places BE Desktop k 2 items 4 Double click the SDKC_ROOT Packages SetupSDK bat file This will launch a new window and will setup the packages as required Once it has finished press any key and the window will close 5 Unzip the SDKC zip file into SDKC_ROOT SDK 6 If you purchased the optional J1939 Starter unzip this into SDKC_ROOT SDK ProjectTemplates You should then have a J1939Starter folder Page 4 SDK C User Guide Version 1 40 You should now have everything installed and your SDKC_ROOT folder D SKDC in this example should look like the figure below G ll 5 C GO gt Computer DATA D SDKC a s KC r3 E 5 D SSS File Edit View Tools Help Organize v Include in library v Share with w Burn New folder B 0 e ae Esronies Name Date modified Type Size Total size Space free jj Downloads De Packages 28 07 2011 21 12 File folder J Dropbox D sok 20 02 2012 16 17 File folder El Recent P
30. tring data Topology of the tool The figure below shows the main elements of the language table spreadsheet Page 18 SDK C User Guide Version 1 40 NB LANGUAGE t2 Using UTF8 Strings ESPA OL FRANCAIS Pz LANGUAGE IDIOMA LANGUE ER CONFIG MENU MEN DE CONFIG MENU CONFIG REA SETTING MENU MEN DE AJUSTES MENU REGLAGE rra SETTINGS AJUSTES REGLAGES ier BLEEP BIP BIP RE RESTORE DEFAULTS RESTORE DEFAULTS REGLAGES USINE pupu PROG TX ROG TX PROG TX Fur INFO COM INDICATEUR COM Ama ABOUT ABOUT EI Sending Program Enviar Programa Envoi du Programme Far Receiving recepci n R ception serr The main elements are Red Zone Phrase storage array names and labels that are to be used within the app to access the phrases and words White Zone Phrases and words entered here to the right of the red zone are the strings that will be available for use within your app Each column represents a language String format selection cell light green This cell is for selection of the format of string data storage when source code is generated Click here button green Clicking on this button initiates the processing of the data and generation of the source code files that can be incorporated in your project Parameter zone light blue This area contains parameters that affect aspects of source code generation You shouldn t normally need to make any changes to these Preproces
31. uration Failure Rate Ready NUM A On the back of the Target unit there is a small flap under which is a USB Type A Connector and a small button beside it This will put the unit into USB boot mode do the following e With the unit powered off hold down the small button e Turn on the power to the unit while keeping the button held down e Keep the button held down for at least 2 seconds before releasing it Now plug a USB Male Type A to USB Male Type A lead into the unit and also to the PC Windows will install a standard HID driver for the unit there are no special drivers needed Once Windows has finished installing the HID device driver click the Scan Devices button You should see the A slot change to Monitoring with a HID compliant device and a green Start button will appear as shown on the following screen ims om oc eX File Options Help A Hub 8 Port 3 B Unassigned C Unassigned D Unassigned Monitoring Drive s HID compliant device Status Information v1 6 2 048 CANtronik Profile MX28 Releasei2 13 20120220 v Started Successful Operations Scan devices S Status No USB ports selected Elapsed Failed Operations tart Version Average Duration Failure Rate Ready NUM MM J From the Profile drop down select the MX28 Release13 13 profile this is the most recent firmware release with a special test application in it or the profile with th
32. ware Compiling To compile your app for the Target you need to use the Eclipse IDE To run the Eclipse IDE double click on the LaunchEclipse bat file located under the SDKC_ROOT folder IMPORTANT NOTE If this is the first time you have run the Eclipse IDE there are a few settings that need to be made before we build a project From the Window gt Preferences menu under the General gt Workspace section make sure that the Build automatically option is not checked and the Refresh automatically and Save automatically before build options are both checked To build your project please follow these steps 1 Select File gt Import from the menu 2 Under General select Existing Projects into Workspace and click the Next button 3 Click the Select root directory Browse button navigate to SDKC_ROOT SDK Projects folder and click the OK button 4 Your project s should be shown in the Projects list with a tick against them Click the Finish button Your project s should appear in the Project Explorer pane 5 Inthe Project Explorer pane right click on the project you wish to build From the context menu select Build Configurations gt Set Active gt Release to select release build mode 6 Right click on the project in the Project Explorer again and select Build Project Your Release executable should now be built and copied to the rootfs app bin project sub folder Please note that Debug builds produce an executable with Debug appende
33. x53 x56 x45 x4E x53 x4B x41 const unsigned char cucSystemlUords O0001 003 xE4 xB8 xAD xE6 x96 x87 y U 4E2D U 6587 The role of these comments is to help you to check that you have available in your font any special characters used in the phrase word data of your app Font Customisation While FreeType font usage is covered in the SDK C Scalable Fonts Guide it is probably appropriate to outline a method that you may use to get all characters that occur in your phrase words language data into your font data This method requires access to a font creation font editing tool The SDK does not have such a tool There are commercial and freeware font tools available from various vendors and resource sites FontForge a free font editor available from fontforge sourceforge net may have capabilities to perform the actions described below For simplicity we ll assume arial as a base font here but you can choose whatever font you wish to incorporate in your app The comments in the inc file are there to help you ensure that you gather together all the characters that your app needs so that you can make appropriate font provision Let us use the sample code in Error Reference source not found to check character availability Page 22 SDK C User Guide Version 1 40 We can see that character codepoints appearing in the comments of the snippet are U D1 U 4E2D U 6587 So we need to check if these are present in our Arial

Download Pdf Manuals

image

Related Search

Related Contents

User guide – ISP (Individual study plans for doctoral students)  Porte scorrevoli motorizzate Manuale per l`utente  lnsi`rucfion monuafl Bedienungsanieii`ung Mode d`emploi  ART3.1BT - House of Music & Accessories  EX88HV Inst - Micro Alarm  Gefen CAT5-1600HD  

Copyright © All rights reserved.
Failed to retrieve file