SlideShare a Scribd company logo
淺談-從FW看C語言
feathertw@gmail.com
翔翔
Issue?
● What's the different between SOC and MCU?
● What’s a 32bit architecture mean?
● What’s ARM and ST relationship?
● What is stack point, link register, program counter in Cortex-M?
● How to program C code with considering BUS architeture?
● Assembly is really neccessary in Cortex-M when init C code environment?
● How an OS use CPU mode to protect task without MMU?
● Choose Cortex-M4 is good for running DSP code?
C Program
語法
平台編譯
C規格、資料結構…
CPU、Periperal、OS…Compiler、Linker、Debuger…
SOC & MCU
ARM Cortex-A Series
ARM Cortex-M Series
ARM & ST
● CPU
○ Cortex
A,R,M
● Debug
● ToolChain
● Software
Ecosystem
● (BUS)
● Package
○ LQFP144
○ BGA
● Memory
○ Flash
○ Ram
● Peripheral
○ Timer
○ Uart
IC Industry Chain
Cortex-M4F
● 32bit、3stage pipeline
● FPU、SIMD、MAC instruction
● CMSIS
○ Core info
○ Vendor Peripheral Mapping
○ OS interface
○ Library
○ Function
■ __disable_irq()
■ __ROR()
■ __WFI()
BUS-AMBA
Register
NVIC
● Nested, Vector Table
● Priority
○ vendor implement
○ group priority、subpriority
○ low number means high priority
● Exception stack frame
○ R0、R1、R2、R3、R12、LR、PC、xPSR
● Exception return
○ Return to Handler mode 0XFFFFFFF1
○ Return to Thread mode and using MSP 0xFFFFFFF9
○ Return to Thread mode and using PSP 0xFFFFFFFD
● Vector Table Offset Register (VTOR)
Thumb-2 ISA
● 16bit、32bit instruction(16bit with low register)
○ .N .W
○ MOVW、MOVT
○ CLZ
● Instruction with postfix ‘S’
● Access memory
○ LDR R2, [R3] ;R2 = mem32[R3]
○ LDR R2, [R3, #4] ;R2 = mem32[R3 + 4]
○ LDR R2, [R3,#4]! ;R2 = mem32[R3 + 4] ; R3 = R3 + 4
○ LDR R2, [R3], #4 ;R2 = mem32[R3] ; R3 = R3 + 4
● IF-THEN Instruction
○ if else in 4 instruction
RTOS
● Systick
● Processor mode
○ Thread mode、Handler mode
○ Unprivileged、Privileged
○ MSP、PSP
○ Control register
○ SVC #
● MPU
Toolchain
.c .s .o .elf .bin
gcc as ld objcopy
● Toolchain
○ cross-compiler
○ gcc、as、ld、objcopy、objdump、gdb
Compile
● Section
○ CODE
○ DATA
○ BSS
● Linker
● C Programming Initial
● AAPCS
● Const issue
MEMORY
{
FLASH (rx) : ORIGIN = 0x00000000,
LENGTH = 0x00040000
RAM (rwx) : ORIGIN = 0x01000000,
LENGTH = 0x00040000
}
SECTIONS
{
.text :
{
_stext = . ;
*(vectors)
*(.text)
_etext = . ;
} > FLASH
.data : AT(_etext)
{
_sdata = . ;
*(.rodata*)
*(.data)
_edata = . ;
} > RAM
data_size = _edata - _sdata ;
.bss :
{
_sbss = . ;
*(.bss)
_ebss = . ;
} > RAM
bss_size = _ebss - _sbss ;
}
FPU
● gcc parameter
○ -mfloat-abi=soft
○ -mfloat-abi=softfp
○ -mfloat-abi=hard
● Lazy stacking feature
● Floating-point register with context switch
Q&A
Do you really know how do program run?
#include <stdio.h>
#include <unistd.h>
int main()
{
int i;
for(i=0; i<3; i++)
{
fork();
printf("-");
}
return 0;
}
$ gcc fork.c -o fork && ./fork | wc -c
Explain output number!
THX

More Related Content

What's hot

BUD17-302: LLVM Internals #2
BUD17-302: LLVM Internals #2 BUD17-302: LLVM Internals #2
BUD17-302: LLVM Internals #2
Linaro
 
LAS16-501: Introduction to LLVM - Projects, Components, Integration, Internals
LAS16-501: Introduction to LLVM - Projects, Components, Integration, InternalsLAS16-501: Introduction to LLVM - Projects, Components, Integration, Internals
LAS16-501: Introduction to LLVM - Projects, Components, Integration, Internals
Linaro
 
BKK16-403 Android HAL Consolidation Status
BKK16-403 Android HAL Consolidation StatusBKK16-403 Android HAL Consolidation Status
BKK16-403 Android HAL Consolidation Status
Linaro
 
BKK16-402 Cross distro BoF
BKK16-402 Cross distro BoFBKK16-402 Cross distro BoF
BKK16-402 Cross distro BoF
Linaro
 
Smartcom's control plane software, a customized version of FreeBSD by Boris A...
Smartcom's control plane software, a customized version of FreeBSD by Boris A...Smartcom's control plane software, a customized version of FreeBSD by Boris A...
Smartcom's control plane software, a customized version of FreeBSD by Boris A...
eurobsdcon
 
BUD17-214: Bus scaling QoS update
BUD17-214: Bus scaling QoS update BUD17-214: Bus scaling QoS update
BUD17-214: Bus scaling QoS update
Linaro
 
BUD17-300: Journey of a packet
BUD17-300: Journey of a packetBUD17-300: Journey of a packet
BUD17-300: Journey of a packet
Linaro
 
BUD17-310: Introducing LLDB for linux on Arm and AArch64
BUD17-310: Introducing LLDB for linux on Arm and AArch64 BUD17-310: Introducing LLDB for linux on Arm and AArch64
BUD17-310: Introducing LLDB for linux on Arm and AArch64
Linaro
 
Ostech war story using mainline linux for an android tv bsp
Ostech  war story  using mainline linux  for an android tv bspOstech  war story  using mainline linux  for an android tv bsp
Ostech war story using mainline linux for an android tv bsp
Neil Armstrong
 
Cilium - Container Networking with BPF & XDP
Cilium - Container Networking with BPF & XDPCilium - Container Networking with BPF & XDP
Cilium - Container Networking with BPF & XDP
Thomas Graf
 
BKK16-103 OpenCSD - Open for Business!
BKK16-103 OpenCSD - Open for Business!BKK16-103 OpenCSD - Open for Business!
BKK16-103 OpenCSD - Open for Business!
Linaro
 
LAS16-211: Using LAVA V2 for advanced KVM testing
LAS16-211: Using LAVA V2 for advanced KVM testingLAS16-211: Using LAVA V2 for advanced KVM testing
LAS16-211: Using LAVA V2 for advanced KVM testing
Linaro
 
LAS16-507: LXC support in LAVA
LAS16-507: LXC support in LAVALAS16-507: LXC support in LAVA
LAS16-507: LXC support in LAVA
Linaro
 
BKK16-307 LHG OE Initiative
BKK16-307 LHG OE InitiativeBKK16-307 LHG OE Initiative
BKK16-307 LHG OE Initiative
Linaro
 
BKK16-100K1 George Grey, Linaro CEO Opening Keynote
BKK16-100K1 George Grey, Linaro CEO Opening KeynoteBKK16-100K1 George Grey, Linaro CEO Opening Keynote
BKK16-100K1 George Grey, Linaro CEO Opening Keynote
Linaro
 
BUD17-TR02: Upstreaming 101
BUD17-TR02: Upstreaming 101 BUD17-TR02: Upstreaming 101
BUD17-TR02: Upstreaming 101
Linaro
 
LAS16-403: GDB Linux Kernel Awareness
LAS16-403: GDB Linux Kernel AwarenessLAS16-403: GDB Linux Kernel Awareness
LAS16-403: GDB Linux Kernel Awareness
Linaro
 
BKK16-210 Migrating to the new dispatcher
BKK16-210 Migrating to the new dispatcherBKK16-210 Migrating to the new dispatcher
BKK16-210 Migrating to the new dispatcher
Linaro
 
BUD17-405: Building a reference IoT product with Zephyr
BUD17-405: Building a reference IoT product with Zephyr BUD17-405: Building a reference IoT product with Zephyr
BUD17-405: Building a reference IoT product with Zephyr
Linaro
 
Cilium - BPF & XDP for containers
Cilium - BPF & XDP for containersCilium - BPF & XDP for containers
Cilium - BPF & XDP for containers
Thomas Graf
 

What's hot (20)

BUD17-302: LLVM Internals #2
BUD17-302: LLVM Internals #2 BUD17-302: LLVM Internals #2
BUD17-302: LLVM Internals #2
 
LAS16-501: Introduction to LLVM - Projects, Components, Integration, Internals
LAS16-501: Introduction to LLVM - Projects, Components, Integration, InternalsLAS16-501: Introduction to LLVM - Projects, Components, Integration, Internals
LAS16-501: Introduction to LLVM - Projects, Components, Integration, Internals
 
BKK16-403 Android HAL Consolidation Status
BKK16-403 Android HAL Consolidation StatusBKK16-403 Android HAL Consolidation Status
BKK16-403 Android HAL Consolidation Status
 
BKK16-402 Cross distro BoF
BKK16-402 Cross distro BoFBKK16-402 Cross distro BoF
BKK16-402 Cross distro BoF
 
Smartcom's control plane software, a customized version of FreeBSD by Boris A...
Smartcom's control plane software, a customized version of FreeBSD by Boris A...Smartcom's control plane software, a customized version of FreeBSD by Boris A...
Smartcom's control plane software, a customized version of FreeBSD by Boris A...
 
BUD17-214: Bus scaling QoS update
BUD17-214: Bus scaling QoS update BUD17-214: Bus scaling QoS update
BUD17-214: Bus scaling QoS update
 
BUD17-300: Journey of a packet
BUD17-300: Journey of a packetBUD17-300: Journey of a packet
BUD17-300: Journey of a packet
 
BUD17-310: Introducing LLDB for linux on Arm and AArch64
BUD17-310: Introducing LLDB for linux on Arm and AArch64 BUD17-310: Introducing LLDB for linux on Arm and AArch64
BUD17-310: Introducing LLDB for linux on Arm and AArch64
 
Ostech war story using mainline linux for an android tv bsp
Ostech  war story  using mainline linux  for an android tv bspOstech  war story  using mainline linux  for an android tv bsp
Ostech war story using mainline linux for an android tv bsp
 
Cilium - Container Networking with BPF & XDP
Cilium - Container Networking with BPF & XDPCilium - Container Networking with BPF & XDP
Cilium - Container Networking with BPF & XDP
 
BKK16-103 OpenCSD - Open for Business!
BKK16-103 OpenCSD - Open for Business!BKK16-103 OpenCSD - Open for Business!
BKK16-103 OpenCSD - Open for Business!
 
LAS16-211: Using LAVA V2 for advanced KVM testing
LAS16-211: Using LAVA V2 for advanced KVM testingLAS16-211: Using LAVA V2 for advanced KVM testing
LAS16-211: Using LAVA V2 for advanced KVM testing
 
LAS16-507: LXC support in LAVA
LAS16-507: LXC support in LAVALAS16-507: LXC support in LAVA
LAS16-507: LXC support in LAVA
 
BKK16-307 LHG OE Initiative
BKK16-307 LHG OE InitiativeBKK16-307 LHG OE Initiative
BKK16-307 LHG OE Initiative
 
BKK16-100K1 George Grey, Linaro CEO Opening Keynote
BKK16-100K1 George Grey, Linaro CEO Opening KeynoteBKK16-100K1 George Grey, Linaro CEO Opening Keynote
BKK16-100K1 George Grey, Linaro CEO Opening Keynote
 
BUD17-TR02: Upstreaming 101
BUD17-TR02: Upstreaming 101 BUD17-TR02: Upstreaming 101
BUD17-TR02: Upstreaming 101
 
LAS16-403: GDB Linux Kernel Awareness
LAS16-403: GDB Linux Kernel AwarenessLAS16-403: GDB Linux Kernel Awareness
LAS16-403: GDB Linux Kernel Awareness
 
BKK16-210 Migrating to the new dispatcher
BKK16-210 Migrating to the new dispatcherBKK16-210 Migrating to the new dispatcher
BKK16-210 Migrating to the new dispatcher
 
BUD17-405: Building a reference IoT product with Zephyr
BUD17-405: Building a reference IoT product with Zephyr BUD17-405: Building a reference IoT product with Zephyr
BUD17-405: Building a reference IoT product with Zephyr
 
Cilium - BPF & XDP for containers
Cilium - BPF & XDP for containersCilium - BPF & XDP for containers
Cilium - BPF & XDP for containers
 

Similar to C from FW

Embedded Systems
Embedded SystemsEmbedded Systems
Embedded Systems
Abhishek Sood
 
A Journey into Hexagon: Dissecting Qualcomm Basebands
A Journey into Hexagon: Dissecting Qualcomm BasebandsA Journey into Hexagon: Dissecting Qualcomm Basebands
A Journey into Hexagon: Dissecting Qualcomm Basebands
Priyanka Aash
 
BKK16-302: Android Optimizing Compiler: New Member Assimilation Guide
BKK16-302: Android Optimizing Compiler: New Member Assimilation GuideBKK16-302: Android Optimizing Compiler: New Member Assimilation Guide
BKK16-302: Android Optimizing Compiler: New Member Assimilation Guide
Linaro
 
Module 2 ARM CORTEX M3 Instruction Set and Programming
Module 2 ARM CORTEX M3 Instruction Set and ProgrammingModule 2 ARM CORTEX M3 Instruction Set and Programming
Module 2 ARM CORTEX M3 Instruction Set and Programming
Amogha Bandrikalli
 
Lecture 03 basics of pic
Lecture 03 basics of picLecture 03 basics of pic
Lecture 03 basics of pic
Vajira Thambawita
 
arm.pptx
arm.pptxarm.pptx
Auto Tuning
Auto TuningAuto Tuning
Arm cortex-m4 programmer model
Arm cortex-m4 programmer modelArm cortex-m4 programmer model
Arm cortex-m4 programmer model
Mohammed Gomaa
 
LAS16-201: ART JIT in Android N
LAS16-201: ART JIT in Android NLAS16-201: ART JIT in Android N
LAS16-201: ART JIT in Android N
Linaro
 
Reverse Engineering 101
Reverse Engineering 101Reverse Engineering 101
Reverse Engineering 101
GDSC UofT Mississauga
 
DESIGN OF A 16-BIT HARVARD STRUCTURED RISC PROCESSOR IN CADENCE 45nmTECHNOLOGY
DESIGN OF A 16-BIT HARVARD STRUCTURED RISC PROCESSOR  IN CADENCE 45nmTECHNOLOGYDESIGN OF A 16-BIT HARVARD STRUCTURED RISC PROCESSOR  IN CADENCE 45nmTECHNOLOGY
DESIGN OF A 16-BIT HARVARD STRUCTURED RISC PROCESSOR IN CADENCE 45nmTECHNOLOGY
shaikalthaf40
 
Intel µp instruction encoding and decoding
Intel µp instruction encoding and decodingIntel µp instruction encoding and decoding
Intel µp instruction encoding and decoding
yocirem
 
CPU.ppd
CPU.ppdCPU.ppd
Introduction to computer architecture .pptx
Introduction to computer architecture .pptxIntroduction to computer architecture .pptx
Introduction to computer architecture .pptx
Fatma Sayed Ibrahim
 
A Close Look at ARM Code Size
A Close Look at ARM Code SizeA Close Look at ARM Code Size
A Close Look at ARM Code Size
Samsung Open Source Group
 
LAS16-210: Hardware Assisted Tracing on ARM with CoreSight and OpenCSD
LAS16-210: Hardware Assisted Tracing on ARM with CoreSight and OpenCSDLAS16-210: Hardware Assisted Tracing on ARM with CoreSight and OpenCSD
LAS16-210: Hardware Assisted Tracing on ARM with CoreSight and OpenCSD
Linaro
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051
Denish Vaniyawala
 
SoC Idling for unconf COSCUP 2016
SoC Idling for unconf COSCUP 2016SoC Idling for unconf COSCUP 2016
SoC Idling for unconf COSCUP 2016
Koan-Sin Tan
 

Similar to C from FW (20)

Embedded Systems
Embedded SystemsEmbedded Systems
Embedded Systems
 
A Journey into Hexagon: Dissecting Qualcomm Basebands
A Journey into Hexagon: Dissecting Qualcomm BasebandsA Journey into Hexagon: Dissecting Qualcomm Basebands
A Journey into Hexagon: Dissecting Qualcomm Basebands
 
BKK16-302: Android Optimizing Compiler: New Member Assimilation Guide
BKK16-302: Android Optimizing Compiler: New Member Assimilation GuideBKK16-302: Android Optimizing Compiler: New Member Assimilation Guide
BKK16-302: Android Optimizing Compiler: New Member Assimilation Guide
 
Lecture9
Lecture9Lecture9
Lecture9
 
Module 2 ARM CORTEX M3 Instruction Set and Programming
Module 2 ARM CORTEX M3 Instruction Set and ProgrammingModule 2 ARM CORTEX M3 Instruction Set and Programming
Module 2 ARM CORTEX M3 Instruction Set and Programming
 
Lecture 03 basics of pic
Lecture 03 basics of picLecture 03 basics of pic
Lecture 03 basics of pic
 
arm.pptx
arm.pptxarm.pptx
arm.pptx
 
Auto Tuning
Auto TuningAuto Tuning
Auto Tuning
 
Arm cortex-m4 programmer model
Arm cortex-m4 programmer modelArm cortex-m4 programmer model
Arm cortex-m4 programmer model
 
LAS16-201: ART JIT in Android N
LAS16-201: ART JIT in Android NLAS16-201: ART JIT in Android N
LAS16-201: ART JIT in Android N
 
Reverse Engineering 101
Reverse Engineering 101Reverse Engineering 101
Reverse Engineering 101
 
DESIGN OF A 16-BIT HARVARD STRUCTURED RISC PROCESSOR IN CADENCE 45nmTECHNOLOGY
DESIGN OF A 16-BIT HARVARD STRUCTURED RISC PROCESSOR  IN CADENCE 45nmTECHNOLOGYDESIGN OF A 16-BIT HARVARD STRUCTURED RISC PROCESSOR  IN CADENCE 45nmTECHNOLOGY
DESIGN OF A 16-BIT HARVARD STRUCTURED RISC PROCESSOR IN CADENCE 45nmTECHNOLOGY
 
Arm
ArmArm
Arm
 
Intel µp instruction encoding and decoding
Intel µp instruction encoding and decodingIntel µp instruction encoding and decoding
Intel µp instruction encoding and decoding
 
CPU.ppd
CPU.ppdCPU.ppd
CPU.ppd
 
Introduction to computer architecture .pptx
Introduction to computer architecture .pptxIntroduction to computer architecture .pptx
Introduction to computer architecture .pptx
 
A Close Look at ARM Code Size
A Close Look at ARM Code SizeA Close Look at ARM Code Size
A Close Look at ARM Code Size
 
LAS16-210: Hardware Assisted Tracing on ARM with CoreSight and OpenCSD
LAS16-210: Hardware Assisted Tracing on ARM with CoreSight and OpenCSDLAS16-210: Hardware Assisted Tracing on ARM with CoreSight and OpenCSD
LAS16-210: Hardware Assisted Tracing on ARM with CoreSight and OpenCSD
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051
 
SoC Idling for unconf COSCUP 2016
SoC Idling for unconf COSCUP 2016SoC Idling for unconf COSCUP 2016
SoC Idling for unconf COSCUP 2016
 

Recently uploaded

Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
Kerry Sado
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
R&R Consult
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
AafreenAbuthahir2
 
English lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdfEnglish lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdf
BrazilAccount1
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
ankuprajapati0525
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
ydteq
 
Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
AmarGB2
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
TeeVichai
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
thanhdowork
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
Kamal Acharya
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
Jayaprasanna4
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
gerogepatton
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
obonagu
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Dr.Costas Sachpazis
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
VENKATESHvenky89705
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
zwunae
 

Recently uploaded (20)

Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
 
English lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdfEnglish lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdf
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
 
Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
 

C from FW

  • 2. Issue? ● What's the different between SOC and MCU? ● What’s a 32bit architecture mean? ● What’s ARM and ST relationship? ● What is stack point, link register, program counter in Cortex-M? ● How to program C code with considering BUS architeture? ● Assembly is really neccessary in Cortex-M when init C code environment? ● How an OS use CPU mode to protect task without MMU? ● Choose Cortex-M4 is good for running DSP code?
  • 4. SOC & MCU ARM Cortex-A Series ARM Cortex-M Series
  • 5. ARM & ST ● CPU ○ Cortex A,R,M ● Debug ● ToolChain ● Software Ecosystem ● (BUS) ● Package ○ LQFP144 ○ BGA ● Memory ○ Flash ○ Ram ● Peripheral ○ Timer ○ Uart
  • 7. Cortex-M4F ● 32bit、3stage pipeline ● FPU、SIMD、MAC instruction ● CMSIS ○ Core info ○ Vendor Peripheral Mapping ○ OS interface ○ Library ○ Function ■ __disable_irq() ■ __ROR() ■ __WFI()
  • 10. NVIC ● Nested, Vector Table ● Priority ○ vendor implement ○ group priority、subpriority ○ low number means high priority ● Exception stack frame ○ R0、R1、R2、R3、R12、LR、PC、xPSR ● Exception return ○ Return to Handler mode 0XFFFFFFF1 ○ Return to Thread mode and using MSP 0xFFFFFFF9 ○ Return to Thread mode and using PSP 0xFFFFFFFD ● Vector Table Offset Register (VTOR)
  • 11. Thumb-2 ISA ● 16bit、32bit instruction(16bit with low register) ○ .N .W ○ MOVW、MOVT ○ CLZ ● Instruction with postfix ‘S’ ● Access memory ○ LDR R2, [R3] ;R2 = mem32[R3] ○ LDR R2, [R3, #4] ;R2 = mem32[R3 + 4] ○ LDR R2, [R3,#4]! ;R2 = mem32[R3 + 4] ; R3 = R3 + 4 ○ LDR R2, [R3], #4 ;R2 = mem32[R3] ; R3 = R3 + 4 ● IF-THEN Instruction ○ if else in 4 instruction
  • 12. RTOS ● Systick ● Processor mode ○ Thread mode、Handler mode ○ Unprivileged、Privileged ○ MSP、PSP ○ Control register ○ SVC # ● MPU
  • 13. Toolchain .c .s .o .elf .bin gcc as ld objcopy ● Toolchain ○ cross-compiler ○ gcc、as、ld、objcopy、objdump、gdb
  • 14. Compile ● Section ○ CODE ○ DATA ○ BSS ● Linker ● C Programming Initial ● AAPCS ● Const issue MEMORY { FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000 RAM (rwx) : ORIGIN = 0x01000000, LENGTH = 0x00040000 } SECTIONS { .text : { _stext = . ; *(vectors) *(.text) _etext = . ; } > FLASH .data : AT(_etext) { _sdata = . ; *(.rodata*) *(.data) _edata = . ; } > RAM data_size = _edata - _sdata ; .bss : { _sbss = . ; *(.bss) _ebss = . ; } > RAM bss_size = _ebss - _sbss ; }
  • 15. FPU ● gcc parameter ○ -mfloat-abi=soft ○ -mfloat-abi=softfp ○ -mfloat-abi=hard ● Lazy stacking feature ● Floating-point register with context switch
  • 16. Q&A
  • 17. Do you really know how do program run? #include <stdio.h> #include <unistd.h> int main() { int i; for(i=0; i<3; i++) { fork(); printf("-"); } return 0; } $ gcc fork.c -o fork && ./fork | wc -c Explain output number!
  • 18. THX