Upload
Download free for 30 days
Login
Submit Search
Lecture Presentation 9.pdf fpga soc using c
0 likes
9 views
M
minamelad457
Lecture Presentation 9.pdf
Engineering
Read more
1 of 25
Download now
Download to read offline
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
More Related Content
PPTX
Introduction to computer architecture .pptx
Fatma Sayed Ibrahim
PDF
C programming session10
Keroles karam khalil
PPTX
Embedded C programming session10
Keroles karam khalil
PDF
C programming session9 -
Keroles karam khalil
PPT
Embedded c programming22 for fdp
Pradeep Kumar TS
PDF
Assembly language part I
Mohammed A. Imran
PDF
Assembly language part I
n|u - The Open Security Community
PDF
AllBits presentation - Lower Level SW Security
AllBits BVBA (freelancer)
Introduction to computer architecture .pptx
Fatma Sayed Ibrahim
C programming session10
Keroles karam khalil
Embedded C programming session10
Keroles karam khalil
C programming session9 -
Keroles karam khalil
Embedded c programming22 for fdp
Pradeep Kumar TS
Assembly language part I
Mohammed A. Imran
Assembly language part I
n|u - The Open Security Community
AllBits presentation - Lower Level SW Security
AllBits BVBA (freelancer)
Similar to Lecture Presentation 9.pdf fpga soc using c
(20)
PDF
0100_Embeded_C_CompilationProcess.pdf
KhaledIbrahim10923
PPTX
Unit-2.pptx
sidhantkulkarni1
PDF
AAME ARM Techcon2013 003v02 Software Development
Anh Dung NGUYEN
PDF
Doc8453
khoaicuto
PPTX
CA-Lec2-Chap2-Instructions-HL-2-MCxxx.pptx
JuanDavid747466
DOCX
C tutorials
Amit Kapoor
PPTX
outline : basicc elements of assembly language
rivadiab30663
PDF
Lecture Presentation 10.pdfLecture Presentation 10.pdf
minamelad457
PDF
Embedded web technology makes it possibl
nazirloan
PPTX
chapter2-part1-140329134839-phpapp02.pptx
SangeetaTripathi8
DOCX
C LANGUAGE UNIT-1 PREPARED BY MVB REDDY
Rajeshkumar Reddy
PDF
7986-lect 7.pdf
RiazAhmad521284
PPT
Track A-Compilation guiding and adjusting - IBM
chiportal
PPTX
Compare Performance-power of Arm Cortex vs RISC-V for AI applications_oct_2021
Deepak Shankar
PDF
Lecture Presentation 11.pdfLecture Presentation 9.pdf fpga soc
minamelad457
PPT
Al2ed chapter17
Abdullelah Al-Fahad
PDF
ARM AAE - Developing Code for ARM
Anh Dung NGUYEN
PPTX
Embedded C.pptx
MusthafaKadersha
PPT
Target updated track f
Alona Gradman
PPT
Chip Ex2010 Gert Goossens
Alona Gradman
0100_Embeded_C_CompilationProcess.pdf
KhaledIbrahim10923
Unit-2.pptx
sidhantkulkarni1
AAME ARM Techcon2013 003v02 Software Development
Anh Dung NGUYEN
Doc8453
khoaicuto
CA-Lec2-Chap2-Instructions-HL-2-MCxxx.pptx
JuanDavid747466
C tutorials
Amit Kapoor
outline : basicc elements of assembly language
rivadiab30663
Lecture Presentation 10.pdfLecture Presentation 10.pdf
minamelad457
Embedded web technology makes it possibl
nazirloan
chapter2-part1-140329134839-phpapp02.pptx
SangeetaTripathi8
C LANGUAGE UNIT-1 PREPARED BY MVB REDDY
Rajeshkumar Reddy
7986-lect 7.pdf
RiazAhmad521284
Track A-Compilation guiding and adjusting - IBM
chiportal
Compare Performance-power of Arm Cortex vs RISC-V for AI applications_oct_2021
Deepak Shankar
Lecture Presentation 11.pdfLecture Presentation 9.pdf fpga soc
minamelad457
Al2ed chapter17
Abdullelah Al-Fahad
ARM AAE - Developing Code for ARM
Anh Dung NGUYEN
Embedded C.pptx
MusthafaKadersha
Target updated track f
Alona Gradman
Chip Ex2010 Gert Goossens
Alona Gradman
Ad
Recently uploaded
(20)
PPTX
CONTRACTS IN CONSTRUCTION PROJECTS: TYPES
Surabhi794944
PPTX
wireless networks, mobile computing.pptx
DayaFlorance
PDF
MLpara ingenieira CIVIL, meca Y AMBIENTAL
MarceloArielTisera
PPTX
mechattonicsand iotwith sensor and actuator
hrtec3
PPTX
A Brief Introduction to IoT- Smart Objects: The "Things" in IoT
KeerthanaSahadevan1
PPTX
Petroleum Refining & Petrochemicals.pptx
choksihimanshu
PPTX
Chemical Technological Processes, Feasibility Study and Chemical Process Indu...
Raihan87
PPTX
PRASUNET_20240614003_231416_0000[1].pptx
singlagaurav1311
PPTX
Micro1New.ppt.pptx the mai themes of micfrobiology
nehasingh160179
PDF
distributed database system" (DDBS) is often used to refer to both the distri...
Hemlathadhevi Annadhurai
PPTX
Software Engineering and software moduleing
deepikame6
PPTX
MAD Unit - 3 User Interface and Data Management (Diploma IT)
JappanMavani
PPTX
Module 8- Technological and Communication Skills.pptx
Ramya Nellutla
PDF
Accra-Kumasi Expressway - Prefeasibility Report Volume 1 of 7.11.2018.pdf
JeorgeWilsonKingson1
PDF
Unit1 - AIML Chapter 1 concept and ethics
muthusamyvijay762
PDF
First part_B-Image Processing - 1 of 2).pdf
barabre
PDF
UEFA_Carbon_Footprint_Calculator_Methology_2.0.pdf
tuchinad02
PPTX
ai_satellite_crop_management_20250815030350.pptx
kathiravanh1919
PDF
Influence of Green Infrastructure on Residents’ Endorsement of the New Ecolog...
Journal of Contemporary Urban Affairs
PDF
LOW POWER CLASS AB SI POWER AMPLIFIER FOR WIRELESS MEDICAL SENSOR NETWORK
RandyClara
CONTRACTS IN CONSTRUCTION PROJECTS: TYPES
Surabhi794944
wireless networks, mobile computing.pptx
DayaFlorance
MLpara ingenieira CIVIL, meca Y AMBIENTAL
MarceloArielTisera
mechattonicsand iotwith sensor and actuator
hrtec3
A Brief Introduction to IoT- Smart Objects: The "Things" in IoT
KeerthanaSahadevan1
Petroleum Refining & Petrochemicals.pptx
choksihimanshu
Chemical Technological Processes, Feasibility Study and Chemical Process Indu...
Raihan87
PRASUNET_20240614003_231416_0000[1].pptx
singlagaurav1311
Micro1New.ppt.pptx the mai themes of micfrobiology
nehasingh160179
distributed database system" (DDBS) is often used to refer to both the distri...
Hemlathadhevi Annadhurai
Software Engineering and software moduleing
deepikame6
MAD Unit - 3 User Interface and Data Management (Diploma IT)
JappanMavani
Module 8- Technological and Communication Skills.pptx
Ramya Nellutla
Accra-Kumasi Expressway - Prefeasibility Report Volume 1 of 7.11.2018.pdf
JeorgeWilsonKingson1
Unit1 - AIML Chapter 1 concept and ethics
muthusamyvijay762
First part_B-Image Processing - 1 of 2).pdf
barabre
UEFA_Carbon_Footprint_Calculator_Methology_2.0.pdf
tuchinad02
ai_satellite_crop_management_20250815030350.pptx
kathiravanh1919
Influence of Green Infrastructure on Residents’ Endorsement of the New Ecolog...
Journal of Contemporary Urban Affairs
LOW POWER CLASS AB SI POWER AMPLIFIER FOR WIRELESS MEDICAL SENSOR NETWORK
RandyClara
Ad
Lecture Presentation 9.pdf fpga soc using c
1.
© 2017 Arm
Limited Programming an SoC Using C Language
2.
© 2017 Arm
Limited 2 Module Syllabus Principles of C Programming and Assembly Programming Programming Cortex-M0 Processors using C Language and Assembly Language Writing Assembly Functions Inside C Files
3.
© 2017 Arm
Limited 3 Building a System on a Chip (SoC) Memory VGA Peripheral UART Peripheral Timer Peripheral GPIO Peripheral 7-Segment Peripheral Arm CMSIS-Core Application Programming Interface (API) Application Design (e.g., Game) Arm Cortex-M0 Processor Hardware design Software low-level drivers & libraries programming Software high-level application development Peripheral Drivers AHB Interrupt
4.
© 2017 Arm
Limited 4 C and Assembly Language Review Language Advantages Disadvantages C Easy to learn Limited or no direct access to core registers and stack Portable No direct control over instruction sequence generation Easy handling of complex data structures No direct control over stack usage Assembly Allow direct control to each instruction step and all memory Take longer time to learn Allows direct access to instructions that cannot be generated with C Difficult to manage data structure Less portable
5.
© 2017 Arm
Limited 5 Typical Program-Generation Flow The generation of a program follows a typical development flow. • Compile > Assemble > Link > Download • The generated executable file (or program image) is stored in the program memory (normally an on-chip flash memory), to be fetched by the processor. Data Output C Code Assembly Code Machine Code Libraries Program Image Compile Assemble Link Download Program Memory Fetch Decode Execute Processor Processing Data Input Instruction Fetch Off-line Compilation Typical program-generation flow
6.
© 2017 Arm
Limited 6 Program-Generation Flow with Arm Tools Compile Using Armcc Assemble Using Armasm C Source Code Assembly Source Code Object Files (.o) C/ C++ C/ C++ Libraries Link Using Armlink Executable Program Mage Binary .O Files .S Files .AXF File .LIB file .BIN File .HEX File Disassembly File C, C++ ASM files Download to Program Memory
7.
© 2017 Arm
Limited 7 Program Image 0x00000000 Initial MSP value Code region Start-up routine Vector table Program Image Reset vector NMI vector Hard fault vector Reserved SVC vector Reserved PendSV vector SysTick vector Interrupt vectors 0x00000000 0x00000004 0x00000008 0x0000000C 0x0000002C 0x00000038 0x00000040 0x0000003C Program code C library code
8.
© 2017 Arm
Limited 8 Program Image 0x00000000 Initial MSP value Code region Start-up routine Vector table Program Image Reset vector NMI vector Hard fault vector Reserved SVC vector Reserved PendSV vector SysTick vector Interrupt vectors 0x00000000 0x00000004 0x00000008 0x0000000C 0x0000002C 0x00000038 0x00000040 0x0000003C Program code C library code
9.
© 2017 Arm
Limited 9 Program Image 0x00000000 Initial MSP value Code region Start-up routine Vector table Program Image Reset vector NMI vector Hard fault vector Reserved SVC vector Reserved PendSV vector SysTick vector Interrupt vectors 0x00000000 0x00000004 0x00000008 0x0000000C 0x0000002C 0x00000038 0x00000040 0x0000003C Program code C library code
10.
© 2017 Arm
Limited 10 Program Image 0x00000000 Initial MSP value Code region Start-up routine Vector table Program Image Reset vector NMI vector Hard fault vector Reserved SVC vector Reserved PendSV vector SysTick vector Interrupt vectors 0x00000000 0x00000004 0x00000008 0x0000000C 0x0000002C 0x00000038 0x00000040 0x0000003C Program code C library code
11.
© 2017 Arm
Limited 11 Program Image 0x00000000 Initial MSP value Code region Start-up routine Vector table Program Image Reset vector NMI vector Hard fault vector Reserved SVC vector Reserved PendSV vector SysTick vector Interrupt vectors 0x00000000 0x00000004 0x00000008 0x0000000C 0x0000002C 0x00000038 0x00000040 0x0000003C Program code C library code
12.
© 2017 Arm
Limited 12 Program Image in Global Memory Reserved External Device External RAM Peripherals SRAM Code 0xFFFFFFFF 0xE0000000 Private Peripheral Bus 0xDFFFFFFF 0xA0000000 0x9FFFFFFF 0x60000000 0x5FFFFFFF 0x40000000 0x3FFFFFFF 0x1FFFFFFF 0x20000000 0x00000000 512MB 512MB 512MB 1GB 1GB 512MB 0xE00FFFFF 0xE0100000 Mainly used for data memory e.g., on-chip SRAM, SDRAM Mainly used for program image e.g., on-chip FLASH
13.
© 2017 Arm
Limited 13 Program Data Types Data type Size Signed range Unsigned range char, int8_t, uint8_t Byte -128 to 127 0 to 255 short, int16_t, uint16_t Half word -32768 to 32767 0 to 65535 int, int32_t, uint32_t, long Word -2147483648 to 2147483647 0 to 4294967295 long , int64_t, uint64_t Double word -263 to 263-1 0 to 264-1 float Word -3.4028234 × 1038 to 3.4028234 × 1038 double, long double Double word -1.7976931348623157 ×10308 to 1.7976931348623157 ×10308 pointers Word 0x00 to 0xFFFFFFFF enum Byte/half word/word Smallest possible data type bool (C++), _bool(C) Byte True or false wchar_t Half word 0 to 65535
14.
© 2017 Arm
Limited 14 Data Qualifiers in C Language Const • Never written by program; can be put in ROM to save RAM Volatile • Can be changed outside of normal program flow: ISR, hardware register • Compiler must be careful with optimizations
15.
© 2017 Arm
Limited 15 How Is Data Stored in RAM Typically, data can be stored in three regions: static data, stack, and heap • Static data: contains global variables and static variables • Stack: contains temporary data for local variables, parameter passing in function calls, registers saving during exceptions, etc. • Heap: contains the pieces of memory spaces that are dynamically reserved by function calls, such as “alloc(),” “malloc()” Memory Address Grow Downwards High Stack Static Data Heap Grow Upwards Low
16.
© 2017 Arm
Limited 16 i n t a , b ; c o n s t c h a r c = 1 2 3 ; i n t d = 3 1 ; vo i d m a i n ( vo i d ) { i n t i ; c h a r f [ 3 2 ] ; i n t * a r ray ; a r ray = ( i n t * ) m a l l o c ( 1 2 8 ) ; e = d + 7 ; p r i n t f ( “ H e l l o ! ” ) ; } Example of Data Storage Heap Data Initialized Static Data Stack Data Zero-initialized Static Data Usually stored in volatile memories, e.g., SRAM Usually stored in non-volatile memories, e.g., FLASH Runtime Library Code Initialization Data Constant Data Program Code .text Startup Code
17.
© 2017 Arm
Limited 17 Define Interrupt Vector in C The interrupt vector can be defined in either C language or assembly language. For example, in C: typedef void(* const ExecFuncPtr)(void) __irq; #pragma arm section rodata="exceptions_area” ExecFuncPtr exception_table[] = { (ExecFuncPtr)&Image$$ARM_LIB_STACK$$ZI$$Limit, /* Initial SP */ (ExecFuncPtr)__main, /* Initial PC */ NMIException, HardFaultException, MemManageException, BusFaultException, UsageFaultException, 0, 0, 0, 0, /* Reserved */ SVCHandler, DebugMonitor, 0, /* Reserved */ PendSVC, SysTickHandler /* Configurable interrupts start here...*/ }; #pragma arm section
18.
© 2017 Arm
Limited 18 Define Stack and Heap The stack and heap can be defined in either C language (with a linker file) or assembly language. For example, in C: /* Set stack and heap parameters */ #define STACK_BASE 0x10020000 //stack start address #define STACK_SIZE 0x5000 //length of the stack #define HEAP_BASE 0x10001000 //heap starts address #define HEAP_SIZE 0x10000 – 0x6000 //heap length /* inker generated stack base addresses */ extern unsigned int Image$$ARM_LIB_STACK$$ZI$$Limit extern unsigned int Image$$ARM_LIB_STACKHEAP$$ZI$$Limit …
19.
© 2017 Arm
Limited 19 Define Stack and Heap Define stack and heap in assembly language: Stack_Size EQU 0x00000400 ; 256KB of STACK AREA STACK, NOINIT, READWRITE, ALIGN=4 Stack_Mem SPACE Stack_Size __initial_sp Heap_Size EQU 0x00000400 ; 1MB of HEAP AREA HEAP, NOINIT, READWRITE, ALIGN=4 __heap_base Heap_Mem SPACE Heap_Size __heap_limit
20.
© 2017 Arm
Limited 20 Accessing Peripherals in C Define base addresses for peripherals. Write a value to a peripheral register. Read a value from a peripheral register. #define AHB_VGA_BASE 0x50000000 #define AHB_UART_BASE 0x51000000 #define AHB_TIMER_BASE 0x52000000 #define AHB_GPIO_BASE 0x53000000 #define AHB_7SEG_BASE 0x54000000 #define NVIC_INT_ENABLE 0xE000E100 *(unsigned int*) AHB_TIMER_BASE = 0x3FFFF; //store a value to the peripheral i=*(unsigned int*) AHB_GPIO_BASE; //read a value from the peripheral
21.
© 2017 Arm
Limited 21 Calling a C Function from Assembly When a C function is called from an assembly file, the following areas should be checked: • Register R0, R1, R2, R3, R12, and LR could be changed; hence, it is better to save them to the stack. • The value of SP should be aligned to a double-word address boundary. • Input parameters have to be stored in the correct registers; for example, registers R0 to R3 can be used for passing four parameters. • The return value is usually stored in R0.
22.
© 2017 Arm
Limited 22 Calling a C Function from Assembly ISR can be written in either assembly or C language; for example, in C: Call a C function from the assembly code; for example: void UART_ISR() { char c; c=*(char*) AHB_UART_BASE; //read a character from UART … } UART_Handler PROC EXPORT UART_Handler // label name in assembly IMPORT UART_ISR // function name in C PUSH {R0,R1,R2,LR} // context saving BL UART_ISR // branch to ISR written in C POP {R0,R1,R2,PC} // context restoring ENDP
23.
© 2017 Arm
Limited 23 Calling an Assembly Function from C When calling an assembly function from C code, the following areas should be checked: • If registers R4 to R11 need to be changed, they have to be stacked and restored in the assembly function. • If another function is called inside the assembly function, the LR register needs to be saved on the stack and used for return. • The function return value is normally stored in R0.
24.
© 2017 Arm
Limited 24 Calling an Assembly Function from C Write a function in assembly: Calling an assembly function in C: EXPORT add_asm add_asm FUNCTION ADDS R0, R0, R1 ADDS R0, R0, R2 ADDS R0, R0, R3 BX LR ; result is returned in R0 ENDFUNC external int add_asm( int k1, int k2, int k3, int k4); void main { int x; x = add_asm (11,22,33,44); // call assembly function … }
25.
© 2017 Arm
Limited 25 Embedded Assembly The embedded assembler allows a developer to write assembly functions inside C files: _asm int add_asm( int k1, int k2, int k3, int k4) { ADDS R0, R0, R1 ADDS R0, R0, R2 ADDS R0, R0, R3 BX LR } void main { int x; x = add_asm (11,22,33,44); // call assembly function … }
Download