NuForum Admin
The PinView can access MCU memory with lua file without using KEIL μVision or IAR EWARM. Also, the PinView supports the following operations by lua script:
(1) Access register to verify hardware circuit
(2) Dump SRAM data
(3) Support lua script to quickly implement test program
Lua web site: https://www.lua.org/
Scenario:
(1) User is debugging a customer project but cannot access the source project.
(2) User only has KEIL μVision now but customer uses IAR EWARM to develop projects.
1. Create a lua file. (Lua Example 1)
2. Open the PinView
3. Run the lua file script
4. The PinView log window shows the changes
Lua Example 1: my1.lua – Access GPIOA register to toggle I/O
-- Config
local write_data = 0
local RegAdd = 0x50004008 -- GPIOA_DOUT
-- Print setting
local ext = require("ext")
local print = ext.redirect_print
print(string.format('Hello Nuvoton'));
-- Read register
local read_data = ice:ReadMem32(RegAdd)
print(string.format("ReadMem: addr 0x%08X, data 0x%08X", RegAdd, read_data))
-- Write register
write_data = 0xFFFF-read_data; -- Invert GPIOA data
ice:WriteMem32(RegAdd, write_data)
print(string.format("WriteMem addr 0x%08X, data 0x%08X", RegAdd, write_data))
Lua Example 2: my.lua – Dump SRAM data
-- Config
local RegAdd = 0x20000000 -- SRAM address
local total_size = 256 -- Data length
-- Print setting
local ext = require("ext")
local print = ext.redirect_print
print(string.format('Hello Nuvoton'));
-- Dump SRAM data
local i = 0
while i < total_size do
local read_data = ice:ReadMem32(RegAdd+i)
print(string.format("ReadMem: addr 0x%08X, data 0x%08X", RegAdd+i, read_data))
i = i + 4
end
Products: | Microcontrollers ,8bit 8051 MCUs ,Arm Cortex-M0 MCUs ,Arm Cortex-M23 MCUs ,Arm Cortex-M4 MCUs |
---|---|
Applications: | |
Function: | Software and Tools,Nu Tools,PinView |