Download presentation
Presentation is loading. Please wait.
1
UEE072HM
2
Embedded and Real-Time Systems We will mainly look at embedded systems –Systems which have the computer system embedded within their application area, normally using a specialised single board computer (SBC) –There is a difference between embedded and real-time – one does not imply the other –Hard real-time vs soft real-time
3
Embedded Systems Development Embedded systems require host-target development – this means –The development is done on a different machine than the target –The code must be downloaded to run –Can be running on different CPU and architecture
5
Embedded Systems Development Embedded systems development requires –Mixed language programming – HLL plus assembler –Increased knowledge of tools – compiler, linker and librarians –Use of specialised tools – i.e. down loaders –Special skills to debug code
6
Using C for Embedded Systems A major requirement is for direct memory access, this is achieved using pointers. This style of code is quite common #define ADDRESS 0xFFFF41 main() { char *mem_p; mem_p=(char*)ADDRESS; while !(*mem_p ) ;// do nothing }
7
Using C for Embedded Systems Note –Use of # define –Use of char * –Use of volatile –Casting of return value –Use of binary op & #define ADDRESS 0xFFFF41 #define MASK 0x3 main() { volatile char *mem_p; mem_p=(char*)ADDRESS; while !(*mem_p & MASK ) ;// do nothing }
8
Using C for Embedded Systems Using C in Embedded Systems you will need to know more about –Compilation process –Linking –Storage issues
9
Using C for Embedded Systems Compilation issues –Passing parameters –Naming conventions –Symbol table and map generation –Assembler output
10
Using C for Embedded Systems Why link HLL and ALP? –Speed –Special instructions –Code size
11
Using C for Embedded Systems Ways to link HLL & ALP - passing parameters –Parameter blocks No recursion –Using registers Limited numbers of registers –Using the stack Most favoured method –Many use a combination of the above
12
Using C for Embedded Systems Using the stack for parameter passing, it requires –Creation of stack frame/frame pointer –Instructions to allocate/deallocate a stack frame In 68000 –link and unlk instructions
13
Using C for Embedded Systems We need to understand –Program counter –Frame pointer –Stack pointer –Stack
14
Using C for Embedded Systems On reaching the following C instruction –gets(sr) We will get the following 68000 code –jsr _gets()
15
Using C for Embedded Systems Once in gets with the following C –char * gets( chat * s) –{ –int str[10]; The following assembler will be created –_get: –link a5, #-40
16
Using C for Embedded Systems With the following recursive call –char * gets( chat * s) –{ –int str[10]; –gets(sr);
17
Using C for Embedded Systems On the final } or return statement we would get the following 68000 –unlk a5
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.