Arduino by bishal bhattarai IOE, Pashchimanchal Campus Pokhara, Nepal
Write once on silicon
1. WRITE ONCE ON SILICON AND PLAY IT FOR EVER
: AN EMBEDDED JOURNEY
Sandip Ray
April 29, 2011
2. WHAT TO WRITE ?
2/7/2013
Any thing that comes to your mind.
Any language you can choose.
Write a small C code of your favorite game.
Or your favorite algorithm that you have learned in
your computer science class.
2
3. HOW TO WRITE ?
2/7/2013
Create a Flow Chart of what is inside your
algorithm.
Start
Is
Temp End
> 90 C
Generate
3
Heat
4. IS YOUR CODE CORRECT ?
2/7/2013
Review 2 times before a bug catches your eye.
Share the code with your peer to review it once
again.
Compile the code.
0 Warnings, 0 Errors !!!!
Too good, you have written an excellent code.
If errors are there, you have to go through your
code and try to fix it.
If warnings are there, you have to understand the
source of it and try to avoid it.
4
5. THINK OF OPTIMIZATION
2/7/2013
Optimization in terms of :
CPU Clocks
Code Memory
Data Memory
Power etc.
5
6. OPTIMIZATION IN TERMS OF CPU CLOCKS
2/7/2013
for (i=0;i<100;i++)
{
for(j=0;j<50;j++)
{
for(k=0;k<25;k++)
{
A[i][j][k]= B[i][j]*8 + C[i]*4;
}
}
}
6
7. OPTIMIZATION IN TERMS OF CPU CLOCKS
2/7/2013
for (i=0;i<100;i++)
{
M= C[i]<<2;
for(j=0;j<50;j++)
{
N= B[i][j]<<3;
for(k=0;k<25;k++)
{
A[i][j][k]= M + N;
}
}
} 7
13. COMPILER
2/7/2013
Compiles the code from high level language to
assembly language.
Example : C, C++, Fortran, Java
13
14. ASSEMBLER
2/7/2013
Assembles the assembly code to binary opcodes
and operands.
MOV #40, A
SUB A, B, A
LD *A++, C
14
15. LINKER
2/7/2013
Links the code as per the provided code and data
memory map.
Example : TI C64x Linker, gcc
15
16. DEBUGGER
2/7/2013
To find the bug or fault in the code.
Run
Single Step
Run Till This Point
Step Over
Step Through
Breakpoint
Log
Example : TI Code Composer Studio IDE, gdb. 16
17. SIMULATOR
2/7/2013
Functional Simulator
Instruction Set Simulator
Cycle Accurate Simulator
Example : TI Code Composer Studio IDE
17
18. IS YOUR CODE RUNNING FINE ON SIMULATOR
?
2/7/2013
Debug till the point your expected output doesn’t
appear on the screen.
Ahhhhh…… Finally it is coming !!!
18
19. WANT TO TRY IT OUT ON SILICON ?
2/7/2013
Yes !!! You can run the code on silicon(provided it is
not a mission critical one)
Connect the hardware board with serial port,
parallel port or PCI through JTAG.
Load the object file on processor.
Press Run and see if expected output are coming
on the screen.
If yes, you are done !!!
And don’t forget to check the performance of your
code by using a profiler. 19