The LatticeMico System software is composed of three bundled applications:
- Mico System Builder (MSB)
- C/C++ Software Project Environment (C/C++ SPE)
- Deployment
设计流程:
1、创建一个diamond目标器件的工程,注意综合工具手册要求
2、使用MSB创建一个微控制器平台,添加core,选取所需外设,定义连接。组合好一个MCU。
关联器件地址,关联中断请求优先级,DRC检查,生成LM8.(此处只需点击工具栏的A,I,D,G)
根据xx_inst.v编写XX_top.v文件,要包含soc目录下的xx.v
3、在C/C++ SPE中,建C工程,敲单片机代码。编译好后,配置成片上存储镜像文件 给LM8
4、在MSB中点开处理器的选项,把镜像装载进去,相当于单片机的烧写程序吧。重新生成
5、回到diamond,加载刚才XX_top.v文件(把复制源文件到工程目录选上)。然后可以将单片机作为工程中的一个小模块也可以直接作为顶层,编译,定义管脚,,,配置。
详细流程:
【=============================================================】
一,一,一,一,一,一,一,一,一,一,
【=============================================================】
Task 1: Create a New Lattice Diamond Project
添加源文件,不用添加,不上图了。
综合工具选择,不上图了。
注意综合工具这只支持Synplify Pro,不支持LSE
然后完成后,工程建好了,这部分就OK了。
【=============================================================】
二,二,二,二,二,二,二,二,
【=============================================================】
Task 2: Create LatticeMico8 Platform
2.1 Create a New MSB Platform
启动程序:开始>程序 > Lattice Diamond> Accessories > LatticeMico System.
新建平台:File > New Platform.
不是所有器件都能应用到所有FPGA或CPU
2.2 Add the Microcontroller Core
建立工程的第一步是添加CPU,在左侧元器件栏双击 LatticeMico8,打开对话框
2.3 Add the Peripheral Components
Add the GPIO
双击左侧栏的GPIO,打开对话框
Add the UART
double-click UART to open
2.4 Specify the Connections Between Master and Slave Ports
有两种类型的端口:master ports and slave ports
2.5 Assign Component Addresses
To automatically assign component addresses:
- Choose Platform Tools > Generate Address,
- or click the Generate Base Address button ,
- or right-click in the Editor view and choose Generate Address from the pop-up menu.
其实就是点击上面的,A,I,D,G
2.6 Assign Interrupt Request Priorities
Generate IRQ button
2.7 Perform a Design Rule Check
2.8 Generate the LatticeMico8 Platform
现在要生成mico微处理器平台了,此处会做两件事在目录“lm8_tutor\platform1\soc” directory::
一个 platform1.msb file
一个 platform1.v (Verilog) file
对于verilog用户,platform1.v 文件可以包含到仿真和实例化中去,
要创建,
软件生成了一个 platform1_inst.v 文件,其中包含了调用 platform1_inst.v 的模版,在此微处理器不是顶层的情况下有用
此文件如下:
1 `include "../components/lm8/rtl/verilog/lm8_include_all.v" 2 `include "../components/gpio/rtl/verilog/gpio.v" 3 `include "../components/gpio/rtl/verilog/tpio.v" 4 `include "../components/uart_core/rtl/verilog/uart_core.v" 5 platform1 platform1_u ( 6 .clk_i(clk_i), 7 .reset_n(reset_n) 8 , .LEDPIO_OUT(LEDPIO_OUT) // [4-1:0] 9 , .uartSIN(uartSIN) // 10 , .uartSOUT(uartSOUT) // 11 );