 Welcome to the next practical session of embedded software testing and today we will try to go through a session about code warrior in terms of creating a project and how to debug because we know in dynamic testing we need to execute the embedded software or to the target using a equipment called IDE. So we have integrated development environment so it is basically used for connecting the embedded target with the help of target connectors such as JTAG or any of the debugger reports, BDMs etc then we have the actual target and we have the compiler we are going to be code warrior IDE code warrior is basically an IDE and we will try to understand how we can use it debugger. So basically with the help of that we can see try to set the break points, stop it, view memory and monitor the variables how to watch the memory modified. So like this there are several aspects of that we go to study that in a couple of sessions today we will try to go through a video of code warrior basically we have code warrior connected to a microcontroller most of these free scale microcontrollers they have code warrior used especially in their initial series of HC08, HC12 series processors these are popular processors since almost a couple of decades they are using on the automotive industrial and such microcontrollers applications so let us try to understand how to create a project with an example demonstration, learn how to debug the code, learn how to set the break point and how to watch the memory so these are some of the exercises we try to understand and we will continue the exercise in the next session okay. So basically these videos are one of the embedded expert videos called processor expert software so this series we are referring to understand so in terms of the live session okay. So this YouTube video is a process of software series we will just basically try to go through and in the future session we will try to understand how it works so it is called as a kinetic processor socket with the help of that we will try to understand overview of the code warrior tool okay. So we will begin with an example project workspace this is a window you can see code warrior project workspace where we have components, categories, project listed here and in terms of managing the projects, build settings, debugging and all that we can see here we can see the console where debugging output will be provided so we will try to open an example project so we will click the import project and there is an import project in some of the repositories so we have an import window we can go through the example project here we have one I to C project we have we will try to go through that and we will select that use it you can see the project got selected in the left hand side where it lists the file names with the different folders so we I am trying to build the project what he is saying in terms of the processor expert this is a project file you open the PE file this is a project processor expert project file you can see there are several options coming up in terms of configuration like flash, memory and the components what you want to use it in the project so you can see these are basically the registers part of the processor you can see that internal oscillator clocks and all that these are basically the components of the processor what this does is the processor exploit all this it will have libraries to calculate those registers and ask user to select the CPU, external, internal peripherals because these are the inputs clocks and all this stuff so with the help of that we can choose these options and build the project okay so these are some of the categories that components library that will build in the processor expert of the code wire where you can see the board support, information, CPU, external developers, internal peripherals, logical developers if the board has a connection, then we have an operating system in terms of a small kernel or schedule then we have the software application configuration so you can see in closing all the reviews so there is one OS selected as MCX slide, other components you can select in the top multiple tasks what you want to have it so there are several tasks in this OS components so we are just trying to understand how the UI works so what components are used in the MCX OS that is built as part of the processor expert so these are several methods within the components you want you can configure it there is one library it is being selected here in this and for that library TSSI you can see the library having the different complex components of the library can be selected or deselected or used so basically with the help of that the project is built okay so we can see logical developers in terms of communication many drivers are there multiple peripherals of the processor you can choose like timer what sort of a timer you want to have so this basically this video is building the project similarly we can use it for testing in terms of what is used after loading this project or we move for development and see what configuration it is using and what is the behavior something like watchdog we have and we can see the source we can review if you do not want to have that component so what processor expert does is generates the code for this and builds the project you can click on the generate button and generate the whole project okay so we will try to study another project similarly created in code warrior it is a more simpler one we will try to study it is what it does okay today in terms of code warrior development studio how it works this for this video should the help there is a workspace we can select it in terms of a lab example path so you can create a directory name it and you can store projects in the folder called a work so workspace will have one or more projects will be available but better to have a separate workspace for each project so if there are complicated projects having multiple files and all that so it is able to have one workspace and you can have multiple projects similarly you can build a test project having instrumented code and for the unit which you are interested to feed a more values content of the code and test it what is the behavior of that on top we can build the project this way okay so the code warrior studio editing setup is the first page basic thing is called as a perspective it is a set of different projects settings we can see so you can use this welcome screen to create a new project so we can click that a new project result and you can end the project here for the microcontroller unit that is being specified here you can call it as a lab one you can press next and you can choose what sort of a board we have so one of this process we can select it a whole fire we one is being done it is a family of all the code for process for motor law pre scale so there is a process called MCF 51 it is being selected and so what sort of a connection that we have with the end target from this IDE we can select it so there are different options like USB based video debugger or serial port or a TCP AP or any JTAG etc so P and E USB BDM melding is used here you can have also open source BDM which is already available on the evaluation board any files you want to add you can add it here so cold fire build options you can put it here what sort of a build you want to have you want to have C++ support you want to enable processor macro which helps porting code form any scale down process something like that so to this cold fire so no porting is selected here any input output in terms of in the statements you want to have a console or no console any floating point support you need any optimization or easier debug etc all these options part of the build we need to select so that the embedded software program is getting built okay next we have a rapid application development in terms of building the entire workspace from the project we can select either device initialization the IDE itself using the processor expert what we have seen earlier like in terms of configuring the various values of the registers the devices and all that either you can ask the processor expert to initialize or you yourself can initialize or one of them you can use so here it is not used the processor expert it is no this is used no option is used okay now this lab one project example you can see the different folders that got created in terms of projects things library files and sources so you can see that view of the C++ on the reference on the top side so you can just go ahead and select the project window and when you that you can build the project with build all so it is going to build the entire problem and it will be or build all you can use then you are going to have a create debug configuration how you want to debug this project after you have build or compile the project here with this window you can have the debug configuration there is a example codeware download we wish to how it is the way this has been chosen so basically the program what we have built is trying to get flashed onto the board you can see that the l format so got generated out of that build what we have done in the earlier step same thing can be flashed onto the target board and you can directly go for the debug option it will automatically open the debug perspective here you can see that or you can say now it is downloading onto the target it is burning into the flash and see the debug window showing the window after it is loaded and here you can see the debug operations so what are the things that we have done here you can see the file which file it is being currently program or currently being executed you can see the console in terms of input or output you can see this is simply of that main file what you have seen the source here so the executable code you can see just simple code many in a for loop some reset watchdog is getting done this is why because it has a watchdog circuitry and the watchdog should be again and again satisfied so that no reset is going to happen so any embedded software you know that it should be called in a while one for one book while one is preferred however in this example you can see a for loop so this is the project and you can see you can click the resume option you can do now the program is running on the board you can pause it it will show where it is stopped and where it is running in some way of the source where the project is being executed so it is continuously running around the for loop you can resume it you can stop or terminate the project execution you can disconnect the target which is connected to this IDE debugger environment what happens when you disconnect is because you have flashed and in earlier option you resume or execute so though you have disconnected actually you have flashed the program and asking it to run independent if you keep on coming on the target but the BDM of the target that is being connected will not have any debug option available so here we have the IDE here we have that BDM debugger module and actual target is here so what we try to do here in this IDE we try to load the example program and we have flashed onto the flash circuitry of the target board and we said let it run and it is connected to the target still the target board is running similarly we can connect it back and start executing it so now we can see the source code CC++ view where the original source is displayed if you want you can add a code for example let us see there is a code executing added is a variable called counter is added here and in the form load there is a counter that is getting implemented in the form load so you save it with controllers then since you have changed the source you need to rebuild the workspace so it will be rebuilt so you have the debug connection setup then you can show to the debugger you can see that it is getting downloaded after the debugger and the target is a progress it shows when it is done as it was showing earlier you can see that new code is getting displayed here and this is something of the same shown here and you can see that the debugger is showing this let us program okay now this window shows the different stack trace in terms of what has been called first second what is been called like a call trace it is showing so you can see that what is being used if you click that startup that is what before remaining getting called the basic startup is being used and the assembly of that is being used usually the startup is written in assembly all that basic work in terms of process initialization, cache, translation look ahead buffer, flash phone copy all that instructions will be there part of the startup in any embedded software before the main is actually getting called or executed you can see that there is a main it has come so there is a execution of this this is a counter you can see which we have used it is called global variable some values being displayed since we are continuously pre incrementing it in every cycle so there are about three like values that got updated and also you can see the memory where this counter is lying on the target we can run again this project you can see the counter getting updated or incremented you can also see by moving the cursor on the particular variable of the counter you can also hover it over that declaration as well you can see the values of that what is being shown it is how we can see the values of the variables and do the debugging. So now we can try to set a break point slow on and try to see what is going on this cycle you have to double click here is the pain where PNE pain where you can click and see that break point is being enabled and when you have it good it is going to stop at the break point you can see every run it is being clicked here and it is going to stop because we have set the break point every time the break point is indicate you can see the counter resulting incremented right so if you remove the break point by double clicking and run it and you can go to the break point window you can disable it with this option and run it will run a free execution and while doing the execution when you have stopped it you can modify the value memory or the location what you have seen this will be useful for testing how the behavior of the program to ensure that different aspects of the project variables how it is getting used so that is what the example shows you can have a break point in different places like this some of the embedded systems will allow 3 hardware break points and unlimited software break points here hardware break point means the break points that are getting loaded from the target directly in the target with the actual target memory and the flash which is mapped to the execution program on the RAM. So you see that value being a change from something to 0 so that the new variable value is being loaded that 0 is being loaded you can create a watch point toggle watch point you can click it here and the counter you want to have a watch and break point is enabled here and properties condition we can put for the watch point the counter when it reaches n we should be able to stop and see the watch point 0 now so we are able to resume it and in a moment it is going to show the value of n and it has hit that we can set it back to 0 execute continuously it will be incremented continuously and it stops at 10 we can take it out IN and title now we can see the variable is getting updated this is what the basic debugging aspects of the code warrior one of the popular debugger that is being used in the industry. So in the next session we will try to understand next type of code warrior debugging for different processes okay so in the next video we will try to understand another type of project creation and here same code warrior have a different version is being tried to create a new project and let us try to see the different options you can create a new project you can load the existing project load the project when getting started some tutorials are also there with examples okay so we will try to create a new project click on that new project here you can see this code warrior supporting this set of a processor family like SC08, SC08, SC08, SC08, SC08, SC08 these are basically different microcontrollers we can choose it will give a basic information about the processor in this and the connections that are used so we can have multiple connections for different processors okay one of the SC08 we will try to select we can see in the video so the processor that got selected is MC68, SC08, SC08, SC08, SC08, SC08, SC08, SC08 so in this we can have connections like emulator or PND, multileak or mono 08 interface or full chip simulation where simulation is done without the target connection in of this processor if you select same option is there then we can have languages what you want to have like this project to be created like in C, C++, assembly or relocated the assembly and different platform so C is being selected here the project name it usually the microcontroll project on the free scale will be not in Cp select the folder C is selected here if you want absolute assembly where pure assembly is used for the entire project like that this example the example assembly project or let us try to see because other software will also have assembly code so you may need to test it so in order to do that we need to understand how the assembly code is being organized into the embedded project so there is some LED project that is being created here so any files that you want to have added you can add it in that folder so any rapid application development option you want or you have initialization you want to have your own or processor expert you want to select for assembly it is not there that option so none is selected here so now the project is being created you can see here the source main.asm project libraries and all being displayed here so this is the debugger window on the left hand side where all different debugger cautions are available so if you click on that main.assembly and see on the right hand side there is a assembly that is being displayed so it includes the two libraries I got INC it is under the process specific library also you can see that try to see all the microcontroller related memory map interpreters and all that are defined here in this library we can use any of these variables in our concept that values let us see what is going to be used main.c you can see main.c you can see that main.c is being used and main.c includes the other library included as usual we have in the C similar to that you can see the assembly and assembly on the left hand side you can see the actual source and you can see that CPU cycles how much it is being used small pointer accumulator status of the particular microcontroller being displayed here and you can see the memory that is being used each memory address is 16 bit that specific memory addresses with that MSB first and LSB not being displayed here and we can have a continuation of that single step you want to have you can have step out, step in, halt and final execution on the target we can do, we can do the reset here the single step we can do which you can see step by step the lines have been executed you can set the break point modify any of these values or any testing that you want to have and on it so assembly project being used in the code warrior. You can see the break points if you want to set for a particular line you can set it and watch the accumulator what is coming especially this assembly debugging useful when you want to have a boot software embedded testing related things where different registers want to verify with the right click options you can set the break point and watch window you can see that one tricker sir you can have that with that value modified and see the behavior of the CPU what is going to happen basically load store set sort of a instructions will be there and the stack point is loaded in the memory so let us try to understand the next type of a project how that is being debugged and used this is a K20 family project is being the processor family is being used particularly K and K22 and K28 so it depends on the development part whatever you have that particular processor needs to be selected you can see the several options like we have seen last time the B and E USB multi link connection is being used if you want to use the on board JTAG you can use open source you can use here it is being used so you can select any of this language here in this project device initialization is being used you want to add any files into the project you can search the description option you want to copy the files into the project you can use this option you want to create a main dot C so the environment is being created here you can see that target CPU project K20 therefore and the sources you can see there is a couple of C files and there is a header there is a initialization code generated automatically you can see the MC unit dot C in the header file generated by the tool itself so we should not modify this basically main dot C and see there is a library today used there is a simple counter similarly what we have seen earlier being used here you can build with this hammer option is a drop down in the flash want to do you know the difference like flash is the permission Ram is the one that is going to use the power up we can yes the selection is from here and it is be done and debug here it is option code over here connect or download select one of the options and debug it so it will switch to the debug perspective here and you can see the multiple windows like what we have seen earlier in terms of the trace and source in this assembly so there is a target that is being plugged in here it is right to start here we say you can see this is the break point being set here is counter the break point is being used here is being run now there are stepping command like step in step step return step return from the function you can see there is a break point counter the project has stopped here counter value you can see it here again you run it here you can see that counter value because continuously it is getting called by the program these code warrior 10.2 version that is being used okay so this is how we can use the debugger so loading the project using the project monitoring adding the files setting the break point making the changes into the counter variable and watched in the memory likewise we can have it and we can scale it up for complex targets this way okay so we will continue in the next session in terms of more exercises and till then see you thank you