Files
skills-win/smod_atsc_dev/references/imx6.md
T
Myfro9andClaude Opus 4.8 a7e20d807d imx6: document VM bootstrap, stop hardcoding the cross-compile VM's IP
The VMware segment changed, so the VM moved from 192.168.223.128 to
192.168.154.128 and every hardcoded reference was stale. A freshly-installed
VM also has neither sshd nor the toolchain, which previously only surfaced
half-way through a modify_imx6 iteration.

- fpga-imx6-flow: new "VM prerequisite check" section -- how to detect a
  missing sshd (Connection refused) and reach the guest over vmrun/VMware
  Tools when SSH is impossible, plus the Yocto SDK install + ARM-ELF
  verification step. Records the real gotchas hit during install:
  unattended-upgrades holding the dpkg lock, EOL xenial repos, and CRLF
  breaking scripts pushed into the guest.
- smod_atsc_dev SKILL/imx6.md: refer to CROSS_VM_HOST/USER/PASS, no literal IP.
- imx6_app.py: drop the stale 192.168.223.128 default so a missing
  CROSS_VM_HOST fails loudly instead of dialing the wrong host.

Machine-local values (IP, credentials, vmx/vmrun paths, toolchain prefix)
live in ~/skills_env.md, which stays out of git.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-20 08:11:51 -05:00

86 lines
4.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# imx6 侧(atsc_app)
## 源码
`E:\Xilinx_design\smod\SMOD_ATSC\my_exciter\imx6\src\atsc_app`(Makefile 在这一层):
| 目录 | 内容 |
|---|---|
| `main.c` | 起线程:`fpga_upgrade_task`、`tcp_task`、`web`、`lcd`、`gps`… |
| `bsp/` | 板级:`i2c_drv.c`、`fpga.c`(FPGA 寄存器读写)、`eeprom.c`(配置)、`dac38j82.c`、`dpd_proc.c`、`isys_config.c` |
| `talise/`, `adrv9009/`, `adi_hal/` | ADI ADRV9009 驱动 |
| `sonytuner/` | Sony CXD2878 + FREIA(CXD6821) 解调驱动(从 EMV9.3 移植,见 PR04) |
| `task/` | `upgrade.c`(软件包升级)、`tcp_task.c`、`iweb_task.c`、`tsoip.c`、`iq_rx.c` |
| `inc/` | 头文件;`fpga.h` 里 `FPGA_UPGRADE_I2C_REG_ADDRES = 0xE0` |
同级还有 `imx6/src/web/`(cgi + www 页面,含 `upload.cgi` 远程升级入口)。
## 交叉编译
工具链在 Ubuntu VM 上(主机/用户/密码见 `~\skills_env.md` 的 `CROSS_VM_HOST` /
`CROSS_VM_USER` / `CROSS_VM_PASS`——IP 随 VMware 网段变动,不要写死):
```
/opt/fsl-imx-x11/4.1.15-2.0.0/environment-setup-cortexa7hf-neon-poky-linux-gnueabi
```
流程(`scripts/imx6_app.py build` 已封装):
1. Windows 侧从 git 打包源码 —— **用 `HEAD` 而不是工作区**,这样构建的东西可追溯:
`git -C my_exciter archive --format=tar -o app.tar HEAD:imx6/src/atsc_app`(约 13 MB)
2. SFTP 上传到 VM,解到 **`~/atsc_head_build`**(一个干净目录;不要碰 `~/atsc_tsoip_build/` 之类的旧目录)
3. `bash -lc 'source <envsetup>; cd ~/atsc_head_build && make'` → 产出 `imx_atsc_app`(~2.9 MB ELF)
4. SFTP 取回 Windows
VM 的 sshd 是现代版本,paramiko 5 / OpenSSH 都能连。若报
`kex_exchange_identification: Connection closed`,是 VM 的 sshd 挂了,请用户 `sudo systemctl restart sshd`。
## 部署到设备
设备 `192.168.1.143`,用户 `root`(密码见 `~\skills_env.md` 的 `SMOD_SSH_PASS`)。**它的 SSH 是老 dropbear**,有两个坑:
1. **算法太老**:paramiko 5 会报 `unknown cipher` / `no acceptable host key`。
要用 **paramiko 2.12**(有 TripleDES / aes-cbc / ssh-rsa):
`python -m pip install --target <dir> paramiko==2.12.0`,然后 `PYTHONPATH=<dir>` 跑。
命令行 ssh 则加 `-o HostKeyAlgorithms=+ssh-rsa`。
2. **没有 SFTP 子系统**:`open_sftp()` 直接 `EOF during negotiation`。传文件走 exec channel:
```python
ch = client.get_transport().open_session()
ch.exec_command("cat > /aw/anywave/app/imx_atsc_app_head")
ch.sendall(open(local_bin, "rb").read())
ch.shutdown_write(); assert ch.recv_exit_status() == 0
```
(另一条老路是 SSH 反向端口转发 + 设备侧 `wget`,见 Task04;现在没必要了。)
部署顺序 —— **先落一个新名字,验证 md5,再覆盖 active**,这样传输失败不会毁掉能跑的 app:
```
cat > /aw/anywave/app/imx_atsc_app_head
chmod 755 imx_atsc_app_head
md5sum 对比
cp -a imx_atsc_app_head imx_atsc_app # 覆盖 active
```
`scripts/imx6_app.py deploy` 就是这个顺序。已知好用的备份是 `imx_atsc_app.bak_pre_rx1`。
改完 app 要**冷启动**(断电重启,遵守上电时序)让 `rc.local` 拉起新进程。
## 观察设备
- 日志:`/var/module_log/imx_atsc_app.log`。健康标志:`TALISE_radioOn`、`fb init state ok`、
`fpga[0xBB]=0x03`(sync=1 / tvalid=1)。`imx6_app.py log` 直接拉。
- 配置:`/aw/anywave/cfg/exc_cfg.conf`,`[BLK_SYS_PARA] reg50` 选输入源
—— `0`=Tuner,`1`=TS,`2`=EAS,`3`=TSoIP。
- 网页:`http://192.168.1.143`(`sys_rf.html`、`sys_ts.html`、`sys_set.html`、
`status_info.html`、`log_output.html`、以及远程升级的 `upload.cgi`)。
- 串口控制台(COM 号见 `~/fpga_imx6_flow.json` 的 `ports.imx6`,逐机而异、不入库)能用,但会自动登出、比较飘。**优先走网络 SSH**读日志和跑命令。
- 直接读 FPGA 寄存器可以 `i2cget`,但它会和 app 抢总线;带调试 ILA 的 bit 下更不可靠。
以 app 日志为准,或者临时停掉 app。
## 已知不能用的构建
设备上的 `imx_atsc_app.rx1`、以及任何 `M=2 / lane 0x04` 的变体**会打断 TX**。
git `HEAD` 的版本是 RX1-on-framerA(`M=4` / lane `0x03` / RX1RX2)+ TX 正常的已知好版本。