SlideShare uma empresa Scribd logo
1 de 75
Baixar para ler offline
COPYRIGHT 2016 – Fundação CERTI
eLua _ Lua for
Microcontrollers
Vinicius Zein
Bruno Herrera
COPYRIGHT 2016 – Fundação CERTI
https://br.linkedin.com/in/viniciuszein	
Vinicius Tadeu Zein
	
www.linkedin.com/in/bherrera
Bruno Herrera
COPYRIGHT 2016 – Fundação CERTI
R&D Institute
Founded in 1984 with the mission to
develop technology solutions for products
and processes
500 employees
Private, but results are reinvested in R&D
MCTI and SUFRAMA accredited – projects
with “Lei de Informática”, “Lei do Bem” and
Embrapii
More than 500 clients around the world
The information in this presentation was compiled from sources believed to be
reliable for informational purposes only.
Content includes opinions, presentations, articles, hyperlinks or other third
party content (“Third Party Material”) that is not intended to, nor constitutes an
endorsement by CERTI of the author or the Third Party Materials. The content
and views within the Third Party Material are solely those of the third party and
do not reflect the opinions of CERTI.
The opinions expressed in this presentation and on the following slides are
solely those of the
presenter and not necessarily those of CERTI. CERTI does not guarantee the
accuracy or
reliability of the information provided herein.
.	Disclaimer
COPYRIGHT 2016 – Fundação CERTI
Ag
en
da
CAPÍTULO 1
Introdução
CAPÍTULO 2
Lógica de
negócios
CAPÍTULO 3
Embedded Lua
CAPÍTULO 4
DevKits e build
CAPÍTULO 5
eLua demo
CAPÍTULO 6
Wrap-up
COPYRIGHT 2016 – Fundação CERTI
INTRODUÇÃO
CAPÍTULO 1
COPYRIGHT 2016 – Fundação CERTI
CAPÍTULO 1 | INTRODUÇÃO
O que é Lua?
COPYRIGHT 2016 – Fundação CERTI
CAPÍTULO 1 | INTRODUÇÃO
COPYRIGHT 2016 – Fundação CERTI
CAPÍTULO 1 | INTRODUÇÃO
Onde está Lua?
COPYRIGHT 2016 – Fundação CERTI
CAPÍTULO 1 | INTRODUÇÃO
COPYRIGHT 2016 – Fundação CERTI
LÓGICA DE
NEGÓCIOS
CAPÍTULO 2
COPYRIGHT 2016 – Fundação CERTI
CAPÍTULO 2 | LÓGICA DE NEGÓCIOS
Business Logic with script > Motivação
Processo de
Desenvolvimento
e.g. em C
1.  Alterar código
2.  Compilar
3.  Deploy
COPYRIGHT 2016 – Fundação CERTI
CAPÍTULO 2 | LÓGICA DE NEGÓCIOS
Business Logic with script > Processo de
desenvolvimento
com script	
1.  Alterar código
2.  Compilar
3.  Deploy
COPYRIGHT 2016 – Fundação CERTI
CAPÍTULO 2 | LÓGICA DE NEGÓCIOS
Business Logic with script > Linguagens de script são
simples de se apreender
Menor complexidade
Precisa ser
integrável à
linguagem
compilada
(C, C++)
COPYRIGHT 2016 – Fundação CERTI
CAPÍTULO 2 | LÓGICA DE NEGÓCIOS
Business Logic with script Lua
Por que Lua?
COPYRIGHT 2016 – Fundação CERTI
Porque Lua
é leve x86	–	171K		
arm	–	160K	
arm	–	124K	
liblua.so
COPYRIGHT 2016 – Fundação CERTI
Porque Lua é leve
180K		
171K	
160K	
124K
COPYRIGHT 2016 – Fundação CERTI
Robusta &
estabelecida
COPYRIGHT 2016 – Fundação CERTI
Portátil &
livre
COPYRIGHT 2016 – Fundação CERTI
PODEROSA>permite orientação a objetos
>permite estender aplicações em outras
linguagens
>pode ser estendida por bibliotecas
escritas em outras linguagens
e também
COPYRIGHT 2016 – Fundação CERTI
CAPÍTULO 2 | LÓGICA DE NEGÓCIOS
Business Logic with script Lua
Exemplo 1:
User interface do Set-Top Box CERTI
COPYRIGHT 2016 – Fundação CERTI
COPYRIGHT 2016 – Fundação CERTI
Integração Lua e C
CAPÍTULO 2 | INTEGRAÇÃO LUA E C
	
Módulo	C	
	
Lua
Bind	
	
Módulo	C	
	
Bind	
	
Módulo	C	
	
Bind	
	
Módulo	C	
	
Bind
COPYRIGHT 2016 – Fundação CERTI
Integração Lua e C
CAPÍTULO 3 | EMBEDDED LUA
2 flavors:
>	Aplicação	C	inicializa	scripts	Lua	
>	Script	Lua	carrega	biblioteca	naNva	
É possível ter
a combinação
dos dois
COPYRIGHT 2016 – Fundação CERTI
Integração Lua e C
Aplicação C inicializa máquina Lua
> lua_State *lua_newstate (lua_Alloc f,
void *ud);
> void luaL_openlibs (lua_State *L);
> int luaL_dofile (lua_State *L, const
char *filename);
> int lua_pcall (lua_State *L, int nargs,
int nresults, int msgh);
> void lua_close (lua_State *L);
CAPÍTULO 2 | INTEGRAÇÃO LUA E C
COPYRIGHT 2016 – Fundação CERTI
Integração Lua e C > Inicialização da máquina Lua
CAPÍTULO 2 | INTEGRAÇÃO LUA E C
COPYRIGHT 2016 – Fundação CERTI
Integração Lua e C > Bind para ser usado em Lua
CAPÍTULO 2 | INTEGRAÇÃO LUA E C
COPYRIGHT 2016 – Fundação CERTI
Integração Lua e C > Bind para ser usado em Lua
CAPÍTULO 2 | INTEGRAÇÃO LUA E C
COPYRIGHT 2016 – Fundação CERTI
IntegraçãoLuaeC
COPYRIGHT 2016 – Fundação CERTI
IntegraçãoLuaeC
COPYRIGHT 2016 – Fundação CERTI
IntegraçãoLuaeC
COPYRIGHT 2016 – Fundação CERTI
Integração Lua e C > Biblioteca C ( ? ) em Lua
COPYRIGHT 2016 – Fundação CERTI
CAPÍTULO 2 | EXEMPLOS
Business Logic with script Lua
Exemplo 1:
Modificação do menu do STB Certi
COPYRIGHT 2016 – Fundação CERTI
COPYRIGHT 2016 – Fundação CERTI
CAPÍTULO 2 | EXEMPLOS
COPYRIGHT 2016 – Fundação CERTI
CAPÍTULO 2 | LÓGICA DE NEGÓCIOS
COPYRIGHT 2016 – Fundação CERTI
CAPÍTULO 2 | LÓGICA DE NEGÓCIOS
COPYRIGHT 2016 – Fundação CERTI
CAPÍTULO 2 | LÓGICA DE NEGÓCIOS
COPYRIGHT 2016 – Fundação CERTI
Business Logic with script Lua
Exemplo 2:
Modificação da interface do IP Phone
	
CAPÍTULO 2 | EXEMPLOS
COPYRIGHT 2016 – Fundação CERTI
COPYRIGHT 2016 – Fundação CERTI
Business Logic with script Lua
CAPÍTULO 2 | EXEMPLOS
COPYRIGHT 2016 – Fundação CERTI
Business Logic with script Lua
CAPÍTULO 2 | EXEMPLOS
COPYRIGHT 2016 – Fundação CERTI
CAPÍTULO 2 | EXEMPLOS
Business Logic with script Lua
COPYRIGHT 2016 – Fundação CERTI
Embedded Lua
CAPÍTULO 3
COPYRIGHT 2016 – Fundação CERTI
CAPÍTULO 3 | EMBEDDED LUA
“Microcontrollers are designed for
embedded applications, in contrast to
the microprocessors used in personal
computers or other general purpose
applications consisting of various
discrete chips.”
-Wikipedia
COPYRIGHT 2016 – Fundação CERTI
CAPÍTULO 3 | EMBEDDED LUA
BSP(board support package) / HAL
(hardware abstraction layer) provided
by the “Chip” vendor
Hardware dependent code, not
portable
No operating system
Hard to port applications
Hard to update on the field
Do not forget: it is all about
registers!!
without
addition; basic
and simple
Bare Metal
COPYRIGHT 2016 – Fundação CERTI
CAPÍTULO 3 | EMBEDDED LUA
eLua www.eluaproject.net
Embedded power, driven by Lua
Quickly prototype and develop embedded
software applications with the power of Lua and
run them on a wide range of microcontroller
architectures
MicroPython micropython.org
MicroPython is a lean and efficient
implementation of the Python 3 programming
language that includes a small subset of the
Python standard library and is optimised to run
on microcontrollers and in constrained
environments.
Netduino www.netduino.com
Netduino, an open-source electronics platform
using the .NET Micro Framework.
Cont: JavaME,
Not so bare
Bare Metal
COPYRIGHT 2016 – Fundação CERTI
CAPÍTULO 3 | EMBEDDED LUA
e-Lua Embedded Lua
On a wide range of
microncontrollers
The power of Lua
Flexibility
Rapid prototyping
Reduced time-to-market
COPYRIGHT 2016 – Fundação CERTI
eLua is not an operational system
commercial software
nor GPL
reduced Lua
platform specific
CAPÍTULO 3 | EMBEDDED LUA
COPYRIGHT 2016 – Fundação CERTI
Lightweight,
but...
COPYRIGHT 2016 – Fundação CERTI
Porting eLua > prerequisites
Program memory
128kB (basic image)
256kB (full image)
RAM
minimum 32kB*
Recommended 64kB
* LTR (Lua Tiny RAM) – less than 32kB
CAPÍTULO 3 | EMBEDDED LUA
COPYRIGHT 2016 – Fundação CERTI
CAPÍTULO 3 | EMBEDDED LUA
eLuaArchitecture
COPYRIGHT 2016 – Fundação CERTI
adc
elua
bit
i2c
can
net
cpu
pack
pd
spi
pio
term
pwm
tmr
rpc
uart
eLuaGenericmodules
CAPÍTULO 3 | EMBEDDED LUA
COPYRIGHT 2016 – Fundação CERTI
eLuaPlatformmodules
mbed.pio
lm3.disp
str9.pio
mizar32.lcd
Mizar32.rtc
CAPÍTULO 3 | EMBEDDED LUA
COPYRIGHT 2016 – Fundação CERTI
DevKits e Build
CAPÍTULO 4
COPYRIGHT 2016 – Fundação CERTI
CAPÍTULO 4 | DEVKITS AND BUILD
eLuaSupportedtargets
COPYRIGHT 2016 – Fundação CERTI
src/platform/<name>
> type.h – specific data types
> conf.lua – build configuration file
> stacks.h – stack size definition
> platform.c – platform interface impl
> platform_conf.h – info about platform
and build config
> others: network config, start up,
linker, CPU support package
Porting eLua > structure
CAPÍTULO 4 | DEVKITS AND BUILD
COPYRIGHT 2016 – Fundação CERTI
>type.h–specificdatatypes
Porting eLua >
structure
COPYRIGHT 2016 – Fundação CERTI
>conf.lua–buildconfigurationfile
Porting eLua >
structure
COPYRIGHT 2016 – Fundação CERTI
Porting eLua >
structure
>stacks.h–stacksizedefinition
COPYRIGHT 2016 – Fundação CERTI
>platform.c–platforminterfaceimpl
COPYRIGHT 2016 – Fundação CERTI
>stm32f4xx_conf.h–infoabout
platformandbuildconfig
COPYRIGHT 2016 – Fundação CERTI
Porting eLua > new CPU
CAPÍTULO 3 | EMBEDDED LUA
1.  edit build_data.lua
2.  add a new board to eLua
3.  customize the list of source file and/or
compilation flags
COPYRIGHT 2016 – Fundação CERTI
Porting eLua > new board
CAPÍTULO 3 | EMBEDDED LUA
1.  Name your board - stm32f429disco
2.  Write a configuration file
3.  Change the file list according to the board name
> cp boards/known/stm32-port407z.lua boards/
known/stm32f429disco.lua
> edit stm32f429disco.lua to set up UART and RX/
TX pins
COPYRIGHT 2016 – Fundação CERTI
eLua demo
CAPÍTULO 6
COPYRIGHT 2016 – Fundação CERTI
CAPÍTULO 6 | eLUA DEMO
Target
Action
COPYRIGHT 2016 – Fundação CERTI
CAPÍTULO 6 | eLUA DEMO
Tools
Toolchain
https://launchpad.net/gcc-arm-
embedded/4.9/4.9-2014-q4-major
sudo add-apt-repository ppa:terry.guo/gcc-
arm-embedded
sudo apt-get update
sudo apt-get install gcc-arm-none-eabi
Open OCD
git clone git://git.code.sf.net/p/openocd/
code openocd
cd openocd
git submodule init && git submodule update
&& ./bootstrap && ./configure --enable-
stlink && make && sudo make install
Action
COPYRIGHT 2016 – Fundação CERTI
CAPÍTULO 6 | eLUA DEMO
GPIO
The famous hello world “led blink” at
user space
gpio = (bank * 16) + pin
gpio = 6 * 16 + 14(LD4) = 110
cd /sys/class/gpio
echo 110 > export
echo out > gpio110/direction
Action
COPYRIGHT 2016 – Fundação CERTI
Wrap-up
CAPÍTULO 6
COPYRIGHT 2016 – Fundação CERTI
CAPÍTULO 6 | WRAP-UP
Take away
Use a script language for
app development
Lua is lightweight,
portable and easy to use
eLua runs in
microcontrollers
CAPÍTULO 6 | WRAP-UP
COPYRIGHT 2016 – Fundação CERTI
?
COPYRIGHT 2016 – Fundação CERTI
Obrigado!
https://br.linkedin.com/in/viniciuszein	
https://www.linkedin.com/in/bherrera
COPYRIGHT 2016 – Fundação CERTI
Links úteis
www.lua.org		
site principal para todas as coisas Lua
www.eluaproject.net	
site do projeto eLua
COPYRIGHT 2016 – Fundação CERTI
Referências
Slide 6 h)p://www.lua.org/	
Slide 33, 35 e 36 h)p://www.eluaproject.net

Mais conteúdo relacionado

Destaque

Destaque (13)

TDC2016SP - Trilha Developing for Business
TDC2016SP - Trilha Developing for BusinessTDC2016SP - Trilha Developing for Business
TDC2016SP - Trilha Developing for Business
 
TDC2016SP - Trilha Embarcados
TDC2016SP - Trilha EmbarcadosTDC2016SP - Trilha Embarcados
TDC2016SP - Trilha Embarcados
 
TDC2016SP - Trilha Fintech
TDC2016SP - Trilha FintechTDC2016SP - Trilha Fintech
TDC2016SP - Trilha Fintech
 
TDC2016SP - Trilha Embarcados
TDC2016SP - Trilha EmbarcadosTDC2016SP - Trilha Embarcados
TDC2016SP - Trilha Embarcados
 
TDC2016SP - Trilha Frameworks JavaScript
TDC2016SP - Trilha Frameworks JavaScriptTDC2016SP - Trilha Frameworks JavaScript
TDC2016SP - Trilha Frameworks JavaScript
 
TDC2016SP - Trilha Design Thinking
TDC2016SP - Trilha Design ThinkingTDC2016SP - Trilha Design Thinking
TDC2016SP - Trilha Design Thinking
 
TDC2016SP - Trilha Fintech
TDC2016SP - Trilha FintechTDC2016SP - Trilha Fintech
TDC2016SP - Trilha Fintech
 
TDC2016SP - Trilha Digital Transformation
TDC2016SP - Trilha Digital TransformationTDC2016SP - Trilha Digital Transformation
TDC2016SP - Trilha Digital Transformation
 
TDC2016SP - Trilha Digital Transformation
TDC2016SP - Trilha Digital TransformationTDC2016SP - Trilha Digital Transformation
TDC2016SP - Trilha Digital Transformation
 
TDC2016SP - Trilha Frameworks JavaScript
TDC2016SP - Trilha Frameworks JavaScriptTDC2016SP - Trilha Frameworks JavaScript
TDC2016SP - Trilha Frameworks JavaScript
 
TDC2016SP - Trilha Digital Transformation
TDC2016SP - Trilha Digital TransformationTDC2016SP - Trilha Digital Transformation
TDC2016SP - Trilha Digital Transformation
 
TDC2016SP - Trilha Fintech
TDC2016SP - Trilha FintechTDC2016SP - Trilha Fintech
TDC2016SP - Trilha Fintech
 
TDC2016SP - Trilha Fintech
TDC2016SP - Trilha FintechTDC2016SP - Trilha Fintech
TDC2016SP - Trilha Fintech
 

Semelhante a TDC2016SP - Trilha Embarcados

Semelhante a TDC2016SP - Trilha Embarcados (20)

lua-esc-brazil-2014-presentation
lua-esc-brazil-2014-presentationlua-esc-brazil-2014-presentation
lua-esc-brazil-2014-presentation
 
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
 
Construindo uma-carreira-open-source
Construindo uma-carreira-open-sourceConstruindo uma-carreira-open-source
Construindo uma-carreira-open-source
 
TDC2016SP - O guia da Carreira Open Source
TDC2016SP - O guia da Carreira Open SourceTDC2016SP - O guia da Carreira Open Source
TDC2016SP - O guia da Carreira Open Source
 
Workshop: Construindo uma API RESTFul com Spring Boot
Workshop: Construindo uma API RESTFul com Spring BootWorkshop: Construindo uma API RESTFul com Spring Boot
Workshop: Construindo uma API RESTFul com Spring Boot
 
LAB 03 - Programação Estruturada 2
LAB 03 - Programação Estruturada 2LAB 03 - Programação Estruturada 2
LAB 03 - Programação Estruturada 2
 
Transforme suas APIs em Negócio
Transforme suas APIs em NegócioTransforme suas APIs em Negócio
Transforme suas APIs em Negócio
 
Apresentação QtConBr
Apresentação QtConBrApresentação QtConBr
Apresentação QtConBr
 
DevPira Festival 21 - .NET6 Uma nova forma de construir apis MinimalAPIs
DevPira Festival 21 - .NET6 Uma nova forma de construir apis MinimalAPIsDevPira Festival 21 - .NET6 Uma nova forma de construir apis MinimalAPIs
DevPira Festival 21 - .NET6 Uma nova forma de construir apis MinimalAPIs
 
Comunicação em tempo real com WebRTC e PHP
Comunicação em tempo real com WebRTC e PHPComunicação em tempo real com WebRTC e PHP
Comunicação em tempo real com WebRTC e PHP
 
Remobile
RemobileRemobile
Remobile
 
Do código ao Sucesso com Source-To-Image
Do código ao Sucesso com Source-To-ImageDo código ao Sucesso com Source-To-Image
Do código ao Sucesso com Source-To-Image
 
Utilizando Sistemas Multi-agentes para a Programação de Plataformas Robóticas
Utilizando Sistemas Multi-agentes para a Programação de Plataformas RobóticasUtilizando Sistemas Multi-agentes para a Programação de Plataformas Robóticas
Utilizando Sistemas Multi-agentes para a Programação de Plataformas Robóticas
 
c++-esc-brazil-presentation_v1.0
c++-esc-brazil-presentation_v1.0c++-esc-brazil-presentation_v1.0
c++-esc-brazil-presentation_v1.0
 
20220707_AtoM_in_VINCULUM_RicardoPinho
20220707_AtoM_in_VINCULUM_RicardoPinho20220707_AtoM_in_VINCULUM_RicardoPinho
20220707_AtoM_in_VINCULUM_RicardoPinho
 
TDCSP2019 - Trilha: Machine Learning - Uso de PyTorch para aplicações de Vis...
TDCSP2019  - Trilha: Machine Learning - Uso de PyTorch para aplicações de Vis...TDCSP2019  - Trilha: Machine Learning - Uso de PyTorch para aplicações de Vis...
TDCSP2019 - Trilha: Machine Learning - Uso de PyTorch para aplicações de Vis...
 
Apresentacao
ApresentacaoApresentacao
Apresentacao
 
Testes em uma arquitetura com messageria/streaming (Kafka)
Testes em uma arquitetura com messageria/streaming (Kafka)Testes em uma arquitetura com messageria/streaming (Kafka)
Testes em uma arquitetura com messageria/streaming (Kafka)
 
Introdução Ao Desenvolvimento Para Iphone
Introdução Ao Desenvolvimento Para IphoneIntrodução Ao Desenvolvimento Para Iphone
Introdução Ao Desenvolvimento Para Iphone
 
Mini curso - Ionic Framework
Mini curso - Ionic FrameworkMini curso - Ionic Framework
Mini curso - Ionic Framework
 

Mais de tdc-globalcode

Mais de tdc-globalcode (20)

TDC2019 Intel Software Day - Visao Computacional e IA a servico da humanidade
TDC2019 Intel Software Day - Visao Computacional e IA a servico da humanidadeTDC2019 Intel Software Day - Visao Computacional e IA a servico da humanidade
TDC2019 Intel Software Day - Visao Computacional e IA a servico da humanidade
 
TDC2019 Intel Software Day - Tecnicas de Programacao Paralela em Machine Lear...
TDC2019 Intel Software Day - Tecnicas de Programacao Paralela em Machine Lear...TDC2019 Intel Software Day - Tecnicas de Programacao Paralela em Machine Lear...
TDC2019 Intel Software Day - Tecnicas de Programacao Paralela em Machine Lear...
 
TDC2019 Intel Software Day - ACATE - Cases de Sucesso
TDC2019 Intel Software Day - ACATE - Cases de SucessoTDC2019 Intel Software Day - ACATE - Cases de Sucesso
TDC2019 Intel Software Day - ACATE - Cases de Sucesso
 
TDC2019 Intel Software Day - Otimizacao grafica com o Intel GPA
TDC2019 Intel Software Day - Otimizacao grafica com o Intel GPATDC2019 Intel Software Day - Otimizacao grafica com o Intel GPA
TDC2019 Intel Software Day - Otimizacao grafica com o Intel GPA
 
TDC2019 Intel Software Day - Deteccao de objetos em tempo real com OpenVino
TDC2019 Intel Software Day - Deteccao de objetos em tempo real com OpenVinoTDC2019 Intel Software Day - Deteccao de objetos em tempo real com OpenVino
TDC2019 Intel Software Day - Deteccao de objetos em tempo real com OpenVino
 
TDC2019 Intel Software Day - OpenCV: Inteligencia artificial e Visao Computac...
TDC2019 Intel Software Day - OpenCV: Inteligencia artificial e Visao Computac...TDC2019 Intel Software Day - OpenCV: Inteligencia artificial e Visao Computac...
TDC2019 Intel Software Day - OpenCV: Inteligencia artificial e Visao Computac...
 
TDC2019 Intel Software Day - Inferencia de IA em edge devices
TDC2019 Intel Software Day - Inferencia de IA em edge devicesTDC2019 Intel Software Day - Inferencia de IA em edge devices
TDC2019 Intel Software Day - Inferencia de IA em edge devices
 
Trilha BigData - Banco de Dados Orientado a Grafos na Seguranca Publica
Trilha BigData - Banco de Dados Orientado a Grafos na Seguranca PublicaTrilha BigData - Banco de Dados Orientado a Grafos na Seguranca Publica
Trilha BigData - Banco de Dados Orientado a Grafos na Seguranca Publica
 
Trilha .Net - Programacao funcional usando f#
Trilha .Net - Programacao funcional usando f#Trilha .Net - Programacao funcional usando f#
Trilha .Net - Programacao funcional usando f#
 
TDC2018SP | Trilha Go - Case Easylocus
TDC2018SP | Trilha Go - Case EasylocusTDC2018SP | Trilha Go - Case Easylocus
TDC2018SP | Trilha Go - Case Easylocus
 
TDC2018SP | Trilha Modern Web - Para onde caminha a Web?
TDC2018SP | Trilha Modern Web - Para onde caminha a Web?TDC2018SP | Trilha Modern Web - Para onde caminha a Web?
TDC2018SP | Trilha Modern Web - Para onde caminha a Web?
 
TDC2018SP | Trilha Go - Clean architecture em Golang
TDC2018SP | Trilha Go - Clean architecture em GolangTDC2018SP | Trilha Go - Clean architecture em Golang
TDC2018SP | Trilha Go - Clean architecture em Golang
 
TDC2018SP | Trilha Go - "Go" tambem e linguagem de QA
TDC2018SP | Trilha Go - "Go" tambem e linguagem de QATDC2018SP | Trilha Go - "Go" tambem e linguagem de QA
TDC2018SP | Trilha Go - "Go" tambem e linguagem de QA
 
TDC2018SP | Trilha Mobile - Digital Wallets - Seguranca, inovacao e tendencia
TDC2018SP | Trilha Mobile - Digital Wallets - Seguranca, inovacao e tendenciaTDC2018SP | Trilha Mobile - Digital Wallets - Seguranca, inovacao e tendencia
TDC2018SP | Trilha Mobile - Digital Wallets - Seguranca, inovacao e tendencia
 
TDC2018SP | Trilha .Net - Real Time apps com Azure SignalR Service
TDC2018SP | Trilha .Net - Real Time apps com Azure SignalR ServiceTDC2018SP | Trilha .Net - Real Time apps com Azure SignalR Service
TDC2018SP | Trilha .Net - Real Time apps com Azure SignalR Service
 
TDC2018SP | Trilha .Net - Passado, Presente e Futuro do .NET
TDC2018SP | Trilha .Net - Passado, Presente e Futuro do .NETTDC2018SP | Trilha .Net - Passado, Presente e Futuro do .NET
TDC2018SP | Trilha .Net - Passado, Presente e Futuro do .NET
 
TDC2018SP | Trilha .Net - Novidades do C# 7 e 8
TDC2018SP | Trilha .Net - Novidades do C# 7 e 8TDC2018SP | Trilha .Net - Novidades do C# 7 e 8
TDC2018SP | Trilha .Net - Novidades do C# 7 e 8
 
TDC2018SP | Trilha .Net - Obtendo metricas com TDD utilizando build automatiz...
TDC2018SP | Trilha .Net - Obtendo metricas com TDD utilizando build automatiz...TDC2018SP | Trilha .Net - Obtendo metricas com TDD utilizando build automatiz...
TDC2018SP | Trilha .Net - Obtendo metricas com TDD utilizando build automatiz...
 
TDC2018SP | Trilha .Net - .NET funcional com F#
TDC2018SP | Trilha .Net - .NET funcional com F#TDC2018SP | Trilha .Net - .NET funcional com F#
TDC2018SP | Trilha .Net - .NET funcional com F#
 
TDC2018SP | Trilha .Net - Crie SPAs com Razor e C# usando Blazor em .Net Core
TDC2018SP | Trilha .Net - Crie SPAs com Razor e C# usando Blazor  em .Net CoreTDC2018SP | Trilha .Net - Crie SPAs com Razor e C# usando Blazor  em .Net Core
TDC2018SP | Trilha .Net - Crie SPAs com Razor e C# usando Blazor em .Net Core
 

Último

PROJETO DE EXTENSÃO I - TECNOLOGIA DA INFORMAÇÃO Relatório Final de Atividade...
PROJETO DE EXTENSÃO I - TECNOLOGIA DA INFORMAÇÃO Relatório Final de Atividade...PROJETO DE EXTENSÃO I - TECNOLOGIA DA INFORMAÇÃO Relatório Final de Atividade...
PROJETO DE EXTENSÃO I - TECNOLOGIA DA INFORMAÇÃO Relatório Final de Atividade...
HELENO FAVACHO
 
Slide - EBD ADEB 2024 Licao 02 2Trim.pptx
Slide - EBD ADEB 2024 Licao 02 2Trim.pptxSlide - EBD ADEB 2024 Licao 02 2Trim.pptx
Slide - EBD ADEB 2024 Licao 02 2Trim.pptx
edelon1
 
Os editoriais, reportagens e entrevistas.pptx
Os editoriais, reportagens e entrevistas.pptxOs editoriais, reportagens e entrevistas.pptx
Os editoriais, reportagens e entrevistas.pptx
TailsonSantos1
 
ENSINO RELIGIOSO 7º ANO INOVE NA ESCOLA.pdf
ENSINO RELIGIOSO 7º ANO INOVE NA ESCOLA.pdfENSINO RELIGIOSO 7º ANO INOVE NA ESCOLA.pdf
ENSINO RELIGIOSO 7º ANO INOVE NA ESCOLA.pdf
LeloIurk1
 

Último (20)

Slides Lição 6, CPAD, As Nossas Armas Espirituais, 2Tr24.pptx
Slides Lição 6, CPAD, As Nossas Armas Espirituais, 2Tr24.pptxSlides Lição 6, CPAD, As Nossas Armas Espirituais, 2Tr24.pptx
Slides Lição 6, CPAD, As Nossas Armas Espirituais, 2Tr24.pptx
 
Currículo - Ícaro Kleisson - Tutor acadêmico.pdf
Currículo - Ícaro Kleisson - Tutor acadêmico.pdfCurrículo - Ícaro Kleisson - Tutor acadêmico.pdf
Currículo - Ícaro Kleisson - Tutor acadêmico.pdf
 
PROJETO DE EXTENSÃO I - Radiologia Tecnologia
PROJETO DE EXTENSÃO I - Radiologia TecnologiaPROJETO DE EXTENSÃO I - Radiologia Tecnologia
PROJETO DE EXTENSÃO I - Radiologia Tecnologia
 
PROJETO DE EXTENSÃO I - SERVIÇOS JURÍDICOS, CARTORÁRIOS E NOTARIAIS.pdf
PROJETO DE EXTENSÃO I - SERVIÇOS JURÍDICOS, CARTORÁRIOS E NOTARIAIS.pdfPROJETO DE EXTENSÃO I - SERVIÇOS JURÍDICOS, CARTORÁRIOS E NOTARIAIS.pdf
PROJETO DE EXTENSÃO I - SERVIÇOS JURÍDICOS, CARTORÁRIOS E NOTARIAIS.pdf
 
PROJETO DE EXTENSÃO I - TECNOLOGIA DA INFORMAÇÃO Relatório Final de Atividade...
PROJETO DE EXTENSÃO I - TECNOLOGIA DA INFORMAÇÃO Relatório Final de Atividade...PROJETO DE EXTENSÃO I - TECNOLOGIA DA INFORMAÇÃO Relatório Final de Atividade...
PROJETO DE EXTENSÃO I - TECNOLOGIA DA INFORMAÇÃO Relatório Final de Atividade...
 
About Vila Galé- Cadeia Empresarial de Hotéis
About Vila Galé- Cadeia Empresarial de HotéisAbout Vila Galé- Cadeia Empresarial de Hotéis
About Vila Galé- Cadeia Empresarial de Hotéis
 
Projeto Nós propomos! Sertã, 2024 - Chupetas Eletrónicas.pptx
Projeto Nós propomos! Sertã, 2024 - Chupetas Eletrónicas.pptxProjeto Nós propomos! Sertã, 2024 - Chupetas Eletrónicas.pptx
Projeto Nós propomos! Sertã, 2024 - Chupetas Eletrónicas.pptx
 
Slide - EBD ADEB 2024 Licao 02 2Trim.pptx
Slide - EBD ADEB 2024 Licao 02 2Trim.pptxSlide - EBD ADEB 2024 Licao 02 2Trim.pptx
Slide - EBD ADEB 2024 Licao 02 2Trim.pptx
 
Os editoriais, reportagens e entrevistas.pptx
Os editoriais, reportagens e entrevistas.pptxOs editoriais, reportagens e entrevistas.pptx
Os editoriais, reportagens e entrevistas.pptx
 
migração e trabalho 2º ano.pptx fenomenos
migração e trabalho 2º ano.pptx fenomenosmigração e trabalho 2º ano.pptx fenomenos
migração e trabalho 2º ano.pptx fenomenos
 
Rota das Ribeiras Camp, Projeto Nós Propomos!
Rota das Ribeiras Camp, Projeto Nós Propomos!Rota das Ribeiras Camp, Projeto Nós Propomos!
Rota das Ribeiras Camp, Projeto Nós Propomos!
 
LISTA DE EXERCICIOS envolveto grandezas e medidas e notação cientifica 1 ANO ...
LISTA DE EXERCICIOS envolveto grandezas e medidas e notação cientifica 1 ANO ...LISTA DE EXERCICIOS envolveto grandezas e medidas e notação cientifica 1 ANO ...
LISTA DE EXERCICIOS envolveto grandezas e medidas e notação cientifica 1 ANO ...
 
praticas experimentais 1 ano ensino médio
praticas experimentais 1 ano ensino médiopraticas experimentais 1 ano ensino médio
praticas experimentais 1 ano ensino médio
 
aula de bioquímica bioquímica dos carboidratos.ppt
aula de bioquímica bioquímica dos carboidratos.pptaula de bioquímica bioquímica dos carboidratos.ppt
aula de bioquímica bioquímica dos carboidratos.ppt
 
ENSINO RELIGIOSO 7º ANO INOVE NA ESCOLA.pdf
ENSINO RELIGIOSO 7º ANO INOVE NA ESCOLA.pdfENSINO RELIGIOSO 7º ANO INOVE NA ESCOLA.pdf
ENSINO RELIGIOSO 7º ANO INOVE NA ESCOLA.pdf
 
Análise poema país de abril (Mauel alegre)
Análise poema país de abril (Mauel alegre)Análise poema país de abril (Mauel alegre)
Análise poema país de abril (Mauel alegre)
 
Projeto_de_Extensão_Agronomia_adquira_ja_(91)_98764-0830.pdf
Projeto_de_Extensão_Agronomia_adquira_ja_(91)_98764-0830.pdfProjeto_de_Extensão_Agronomia_adquira_ja_(91)_98764-0830.pdf
Projeto_de_Extensão_Agronomia_adquira_ja_(91)_98764-0830.pdf
 
Atividade - Letra da música Esperando na Janela.
Atividade -  Letra da música Esperando na Janela.Atividade -  Letra da música Esperando na Janela.
Atividade - Letra da música Esperando na Janela.
 
Nós Propomos! Autocarros Elétricos - Trabalho desenvolvido no âmbito de Cidad...
Nós Propomos! Autocarros Elétricos - Trabalho desenvolvido no âmbito de Cidad...Nós Propomos! Autocarros Elétricos - Trabalho desenvolvido no âmbito de Cidad...
Nós Propomos! Autocarros Elétricos - Trabalho desenvolvido no âmbito de Cidad...
 
PRÁTICAS PEDAGÓGICAS GESTÃO DA APRENDIZAGEM
PRÁTICAS PEDAGÓGICAS GESTÃO DA APRENDIZAGEMPRÁTICAS PEDAGÓGICAS GESTÃO DA APRENDIZAGEM
PRÁTICAS PEDAGÓGICAS GESTÃO DA APRENDIZAGEM
 

TDC2016SP - Trilha Embarcados

  • 1. COPYRIGHT 2016 – Fundação CERTI eLua _ Lua for Microcontrollers Vinicius Zein Bruno Herrera
  • 2. COPYRIGHT 2016 – Fundação CERTI https://br.linkedin.com/in/viniciuszein Vinicius Tadeu Zein www.linkedin.com/in/bherrera Bruno Herrera
  • 3. COPYRIGHT 2016 – Fundação CERTI R&D Institute Founded in 1984 with the mission to develop technology solutions for products and processes 500 employees Private, but results are reinvested in R&D MCTI and SUFRAMA accredited – projects with “Lei de Informática”, “Lei do Bem” and Embrapii More than 500 clients around the world
  • 4. The information in this presentation was compiled from sources believed to be reliable for informational purposes only. Content includes opinions, presentations, articles, hyperlinks or other third party content (“Third Party Material”) that is not intended to, nor constitutes an endorsement by CERTI of the author or the Third Party Materials. The content and views within the Third Party Material are solely those of the third party and do not reflect the opinions of CERTI. The opinions expressed in this presentation and on the following slides are solely those of the presenter and not necessarily those of CERTI. CERTI does not guarantee the accuracy or reliability of the information provided herein. . Disclaimer
  • 5. COPYRIGHT 2016 – Fundação CERTI Ag en da CAPÍTULO 1 Introdução CAPÍTULO 2 Lógica de negócios CAPÍTULO 3 Embedded Lua CAPÍTULO 4 DevKits e build CAPÍTULO 5 eLua demo CAPÍTULO 6 Wrap-up
  • 6. COPYRIGHT 2016 – Fundação CERTI INTRODUÇÃO CAPÍTULO 1
  • 7. COPYRIGHT 2016 – Fundação CERTI CAPÍTULO 1 | INTRODUÇÃO O que é Lua?
  • 8. COPYRIGHT 2016 – Fundação CERTI CAPÍTULO 1 | INTRODUÇÃO
  • 9. COPYRIGHT 2016 – Fundação CERTI CAPÍTULO 1 | INTRODUÇÃO Onde está Lua?
  • 10. COPYRIGHT 2016 – Fundação CERTI CAPÍTULO 1 | INTRODUÇÃO
  • 11. COPYRIGHT 2016 – Fundação CERTI LÓGICA DE NEGÓCIOS CAPÍTULO 2
  • 12. COPYRIGHT 2016 – Fundação CERTI CAPÍTULO 2 | LÓGICA DE NEGÓCIOS Business Logic with script > Motivação Processo de Desenvolvimento e.g. em C 1.  Alterar código 2.  Compilar 3.  Deploy
  • 13. COPYRIGHT 2016 – Fundação CERTI CAPÍTULO 2 | LÓGICA DE NEGÓCIOS Business Logic with script > Processo de desenvolvimento com script 1.  Alterar código 2.  Compilar 3.  Deploy
  • 14. COPYRIGHT 2016 – Fundação CERTI CAPÍTULO 2 | LÓGICA DE NEGÓCIOS Business Logic with script > Linguagens de script são simples de se apreender Menor complexidade Precisa ser integrável à linguagem compilada (C, C++)
  • 15. COPYRIGHT 2016 – Fundação CERTI CAPÍTULO 2 | LÓGICA DE NEGÓCIOS Business Logic with script Lua Por que Lua?
  • 16. COPYRIGHT 2016 – Fundação CERTI Porque Lua é leve x86 – 171K arm – 160K arm – 124K liblua.so
  • 17. COPYRIGHT 2016 – Fundação CERTI Porque Lua é leve 180K 171K 160K 124K
  • 18. COPYRIGHT 2016 – Fundação CERTI Robusta & estabelecida
  • 19. COPYRIGHT 2016 – Fundação CERTI Portátil & livre
  • 20. COPYRIGHT 2016 – Fundação CERTI PODEROSA>permite orientação a objetos >permite estender aplicações em outras linguagens >pode ser estendida por bibliotecas escritas em outras linguagens e também
  • 21. COPYRIGHT 2016 – Fundação CERTI CAPÍTULO 2 | LÓGICA DE NEGÓCIOS Business Logic with script Lua Exemplo 1: User interface do Set-Top Box CERTI
  • 22. COPYRIGHT 2016 – Fundação CERTI
  • 23. COPYRIGHT 2016 – Fundação CERTI Integração Lua e C CAPÍTULO 2 | INTEGRAÇÃO LUA E C Módulo C Lua Bind Módulo C Bind Módulo C Bind Módulo C Bind
  • 24. COPYRIGHT 2016 – Fundação CERTI Integração Lua e C CAPÍTULO 3 | EMBEDDED LUA 2 flavors: > Aplicação C inicializa scripts Lua > Script Lua carrega biblioteca naNva É possível ter a combinação dos dois
  • 25. COPYRIGHT 2016 – Fundação CERTI Integração Lua e C Aplicação C inicializa máquina Lua > lua_State *lua_newstate (lua_Alloc f, void *ud); > void luaL_openlibs (lua_State *L); > int luaL_dofile (lua_State *L, const char *filename); > int lua_pcall (lua_State *L, int nargs, int nresults, int msgh); > void lua_close (lua_State *L); CAPÍTULO 2 | INTEGRAÇÃO LUA E C
  • 26. COPYRIGHT 2016 – Fundação CERTI Integração Lua e C > Inicialização da máquina Lua CAPÍTULO 2 | INTEGRAÇÃO LUA E C
  • 27. COPYRIGHT 2016 – Fundação CERTI Integração Lua e C > Bind para ser usado em Lua CAPÍTULO 2 | INTEGRAÇÃO LUA E C
  • 28. COPYRIGHT 2016 – Fundação CERTI Integração Lua e C > Bind para ser usado em Lua CAPÍTULO 2 | INTEGRAÇÃO LUA E C
  • 29. COPYRIGHT 2016 – Fundação CERTI IntegraçãoLuaeC
  • 30. COPYRIGHT 2016 – Fundação CERTI IntegraçãoLuaeC
  • 31. COPYRIGHT 2016 – Fundação CERTI IntegraçãoLuaeC
  • 32. COPYRIGHT 2016 – Fundação CERTI Integração Lua e C > Biblioteca C ( ? ) em Lua
  • 33. COPYRIGHT 2016 – Fundação CERTI CAPÍTULO 2 | EXEMPLOS Business Logic with script Lua Exemplo 1: Modificação do menu do STB Certi
  • 34. COPYRIGHT 2016 – Fundação CERTI
  • 35. COPYRIGHT 2016 – Fundação CERTI CAPÍTULO 2 | EXEMPLOS
  • 36. COPYRIGHT 2016 – Fundação CERTI CAPÍTULO 2 | LÓGICA DE NEGÓCIOS
  • 37. COPYRIGHT 2016 – Fundação CERTI CAPÍTULO 2 | LÓGICA DE NEGÓCIOS
  • 38. COPYRIGHT 2016 – Fundação CERTI CAPÍTULO 2 | LÓGICA DE NEGÓCIOS
  • 39. COPYRIGHT 2016 – Fundação CERTI Business Logic with script Lua Exemplo 2: Modificação da interface do IP Phone CAPÍTULO 2 | EXEMPLOS
  • 40. COPYRIGHT 2016 – Fundação CERTI
  • 41. COPYRIGHT 2016 – Fundação CERTI Business Logic with script Lua CAPÍTULO 2 | EXEMPLOS
  • 42. COPYRIGHT 2016 – Fundação CERTI Business Logic with script Lua CAPÍTULO 2 | EXEMPLOS
  • 43. COPYRIGHT 2016 – Fundação CERTI CAPÍTULO 2 | EXEMPLOS Business Logic with script Lua
  • 44. COPYRIGHT 2016 – Fundação CERTI Embedded Lua CAPÍTULO 3
  • 45. COPYRIGHT 2016 – Fundação CERTI CAPÍTULO 3 | EMBEDDED LUA “Microcontrollers are designed for embedded applications, in contrast to the microprocessors used in personal computers or other general purpose applications consisting of various discrete chips.” -Wikipedia
  • 46. COPYRIGHT 2016 – Fundação CERTI CAPÍTULO 3 | EMBEDDED LUA BSP(board support package) / HAL (hardware abstraction layer) provided by the “Chip” vendor Hardware dependent code, not portable No operating system Hard to port applications Hard to update on the field Do not forget: it is all about registers!! without addition; basic and simple Bare Metal
  • 47. COPYRIGHT 2016 – Fundação CERTI CAPÍTULO 3 | EMBEDDED LUA eLua www.eluaproject.net Embedded power, driven by Lua Quickly prototype and develop embedded software applications with the power of Lua and run them on a wide range of microcontroller architectures MicroPython micropython.org MicroPython is a lean and efficient implementation of the Python 3 programming language that includes a small subset of the Python standard library and is optimised to run on microcontrollers and in constrained environments. Netduino www.netduino.com Netduino, an open-source electronics platform using the .NET Micro Framework. Cont: JavaME, Not so bare Bare Metal
  • 48. COPYRIGHT 2016 – Fundação CERTI CAPÍTULO 3 | EMBEDDED LUA e-Lua Embedded Lua On a wide range of microncontrollers The power of Lua Flexibility Rapid prototyping Reduced time-to-market
  • 49. COPYRIGHT 2016 – Fundação CERTI eLua is not an operational system commercial software nor GPL reduced Lua platform specific CAPÍTULO 3 | EMBEDDED LUA
  • 50. COPYRIGHT 2016 – Fundação CERTI Lightweight, but...
  • 51. COPYRIGHT 2016 – Fundação CERTI Porting eLua > prerequisites Program memory 128kB (basic image) 256kB (full image) RAM minimum 32kB* Recommended 64kB * LTR (Lua Tiny RAM) – less than 32kB CAPÍTULO 3 | EMBEDDED LUA
  • 52. COPYRIGHT 2016 – Fundação CERTI CAPÍTULO 3 | EMBEDDED LUA eLuaArchitecture
  • 53. COPYRIGHT 2016 – Fundação CERTI adc elua bit i2c can net cpu pack pd spi pio term pwm tmr rpc uart eLuaGenericmodules CAPÍTULO 3 | EMBEDDED LUA
  • 54. COPYRIGHT 2016 – Fundação CERTI eLuaPlatformmodules mbed.pio lm3.disp str9.pio mizar32.lcd Mizar32.rtc CAPÍTULO 3 | EMBEDDED LUA
  • 55. COPYRIGHT 2016 – Fundação CERTI DevKits e Build CAPÍTULO 4
  • 56. COPYRIGHT 2016 – Fundação CERTI CAPÍTULO 4 | DEVKITS AND BUILD eLuaSupportedtargets
  • 57. COPYRIGHT 2016 – Fundação CERTI src/platform/<name> > type.h – specific data types > conf.lua – build configuration file > stacks.h – stack size definition > platform.c – platform interface impl > platform_conf.h – info about platform and build config > others: network config, start up, linker, CPU support package Porting eLua > structure CAPÍTULO 4 | DEVKITS AND BUILD
  • 58. COPYRIGHT 2016 – Fundação CERTI >type.h–specificdatatypes Porting eLua > structure
  • 59. COPYRIGHT 2016 – Fundação CERTI >conf.lua–buildconfigurationfile Porting eLua > structure
  • 60. COPYRIGHT 2016 – Fundação CERTI Porting eLua > structure >stacks.h–stacksizedefinition
  • 61. COPYRIGHT 2016 – Fundação CERTI >platform.c–platforminterfaceimpl
  • 62. COPYRIGHT 2016 – Fundação CERTI >stm32f4xx_conf.h–infoabout platformandbuildconfig
  • 63. COPYRIGHT 2016 – Fundação CERTI Porting eLua > new CPU CAPÍTULO 3 | EMBEDDED LUA 1.  edit build_data.lua 2.  add a new board to eLua 3.  customize the list of source file and/or compilation flags
  • 64. COPYRIGHT 2016 – Fundação CERTI Porting eLua > new board CAPÍTULO 3 | EMBEDDED LUA 1.  Name your board - stm32f429disco 2.  Write a configuration file 3.  Change the file list according to the board name > cp boards/known/stm32-port407z.lua boards/ known/stm32f429disco.lua > edit stm32f429disco.lua to set up UART and RX/ TX pins
  • 65. COPYRIGHT 2016 – Fundação CERTI eLua demo CAPÍTULO 6
  • 66. COPYRIGHT 2016 – Fundação CERTI CAPÍTULO 6 | eLUA DEMO Target Action
  • 67. COPYRIGHT 2016 – Fundação CERTI CAPÍTULO 6 | eLUA DEMO Tools Toolchain https://launchpad.net/gcc-arm- embedded/4.9/4.9-2014-q4-major sudo add-apt-repository ppa:terry.guo/gcc- arm-embedded sudo apt-get update sudo apt-get install gcc-arm-none-eabi Open OCD git clone git://git.code.sf.net/p/openocd/ code openocd cd openocd git submodule init && git submodule update && ./bootstrap && ./configure --enable- stlink && make && sudo make install Action
  • 68. COPYRIGHT 2016 – Fundação CERTI CAPÍTULO 6 | eLUA DEMO GPIO The famous hello world “led blink” at user space gpio = (bank * 16) + pin gpio = 6 * 16 + 14(LD4) = 110 cd /sys/class/gpio echo 110 > export echo out > gpio110/direction Action
  • 69. COPYRIGHT 2016 – Fundação CERTI Wrap-up CAPÍTULO 6
  • 70. COPYRIGHT 2016 – Fundação CERTI CAPÍTULO 6 | WRAP-UP
  • 71. Take away Use a script language for app development Lua is lightweight, portable and easy to use eLua runs in microcontrollers CAPÍTULO 6 | WRAP-UP
  • 72. COPYRIGHT 2016 – Fundação CERTI ?
  • 73. COPYRIGHT 2016 – Fundação CERTI Obrigado! https://br.linkedin.com/in/viniciuszein https://www.linkedin.com/in/bherrera
  • 74. COPYRIGHT 2016 – Fundação CERTI Links úteis www.lua.org site principal para todas as coisas Lua www.eluaproject.net site do projeto eLua
  • 75. COPYRIGHT 2016 – Fundação CERTI Referências Slide 6 h)p://www.lua.org/ Slide 33, 35 e 36 h)p://www.eluaproject.net