Skip to content

Ambarella S3L: how to ship the DSP microcode #2767

Open

Description

@openipc-ai

s3l_lite can load and start the DSP, but the image has no microcode, so it gives no video. This issue tracks how the microcode gets onto the image. It follows the discussion in #2763 and #2766.

Where things stand

Decided (see this comment; it replaces the earlier proposal to use stock firmware)

  • Source: a vendor SDK release. Binaries extracted from factory firmware don't pass the tree's binary gate, and a build-time download of them would only sidestep it.
  • Delivery: files in ambarella-osdrv-s3l, like other osdrv blobs, in a separate PR.
  • Version: s3l_2.5.0_20181109, generic set (2018-10-28, svn 284712).
  • Hardware run: done on the IP4M-1026E: real power-on, DSP modes 0 and 1, stream 0. Run with a netboot and initramfs, not from flash. Not tested: 29.97 fps VIN.
  • ISP configuration: same rule. A configuration captured from stock firmware won't ship.

Also still needed for video, separately from this issue: the board's device tree (full iavmem, sensor reset on GPIO 107), the 3A/VIN setup, a streamer (Divinus HAL), and a fix for cold-boot streaming. Details are in #2763.

Activity

  1. DeathCamel58 commented on Nov 6, 2026

    @DeathCamel58
    Contributor

    I'd love some input on this from maintainers because I'm not quite sure the best way to handle this.

    Also for accuracy, there are a number of different microcode versions I've seen for the S3L's DSP (orccode.bin):

    svn ucode date orccode md5 Devices (firmware version)
    257204 2016-05-31 6e1e1fcb… Intelbras VIP 3212 SD IR (2019-12-19), SecPoint SD49225T-HN, two generic Dahua SD speed domes (version unknown)
    264351 2016-10-31 1af9d296… Dahua IPC-HX4X3X-Rhea (V2.460.0001.2.R, 2017-03-07), P143B4 (V2.460.FL01.9.R, 2017-07-19)
    267837 2017-02-22 cc0eb38c… Amcrest IP4M-1026E / IPC-AWXX-V2-Rhea (V2.620.00AC003.0.R, 2022-07-27), Amcrest IPC-HX1X3X-LEXUS (V2.420.AC01.3.R, 2018-02-06), IP4MIAB-36 (V2.460.0000000.16.R, 2017-09-04), VSIP8MPVDIRM (V2.460.0000.14.R, 2017-07-20), Sapsan HX5X3X (V2.460.0000.11.R, 2017-06-08)
    272123 2017-05-18 6ea4f5c0… Dahua SD-Mao-Rhea (V2.600.0000.2, 2017-09-05 and V2.800.0000000.8.R, 2026-09-14), IP2MPTZ-4X (V2.600.0000.1.R, 2017-08-18), PDN49T/PDN22T404G/PDN121AT (V2.622.0000000.7.R, 2018-04-04), RVI IPC52Z12 (V2.623.00GP004.0.R, 2019-05-29), Speco O4P4X (V2.623.00SP006.0.R, 2020-08-11), Nomad (V2.623.00KL709.0.R, 2021-07-07), IPC-PD4249 (2021-07-05)
    279928 2018-03-06 df6ce435… Dahua IPC-HX2X3X-Rhea CustomPro, "Upgrade for 200" (V2.640.1002000.0.R, 2018-07-23)
    281966 2018-07-19 2c471c79… Dahua IPC-HX8X4X-Kronos (V2.622.0000000.5.T, 2020-08-27 and V2.622.0000000.8.R, 2022-01-14), IPC-HX5X3X-Multi-Rhea (V2.622.0000000.41.R, 2024-11-11), IPC-HX5X3X-HDMI-Rhea (V2.622.0000000.51.R, 2025-02-22), IPC-Consumer-Chou-Rhea (V2.622.0000000.18.R, 2026-09-02), IPC-HX2X3X-4G-Rhea (V2.622.9992001.0.R, 2020-05-20), Starlet3X (V2.622.00KL002.0.R, 2021-10-21), Sigma5X (V2.800.00KL00A.0.R, 2021-07-03), HNC3XXX (V2.800.100B000.0.R, 2019-01-19), IPC-144SE244Z and IPC-464484584 (version unknown)
    281966 (rebuild) 2022-01-12 714bd83f… Dahua IPC-HX2X3X-Rhea and IPC-HX5X3X-Rhea (V2.800.0000033.0.R, 2026-08-21), VIPVision VSIPE8MPVDIRMG (2022-12-20)
  2. openipc-ai commented on Nov 7, 2026

    @openipc-ai
    CollaboratorAuthor

    @DeathCamel58 thanks, the table is very useful. It shows how many versions are in the field, which is why a version can't be assumed to work with these modules.

    Source: a vendor SDK release, not stock firmware. This replaces the proposal in the issue description, which I wrote and which was wrong. The tree doesn't accept binaries extracted from factory firmware (§2.4 of best_practices.md, and the "No binaries without a buildable source" gate). A build-time download of the same files would only sidestep that rule, so 267837 from the IP4M-1026E can't be what ships. You can of course keep using it for your own testing.

    Delivery: files in ambarella-osdrv-s3l, like the vendor blobs other osdrv packages ship, such as hevcenc.fwb in xiongmai-osdrv-xm530. No build-time download.

    Versions. These are the S3L SDK releases we have. Each has a generic and an encode_only set. None of them is in your table:

    SDK release ucode date svn generic orccode md5
    s3l_linux_sdk_20161020 2016-10-07 263560 36a49592…
    s3l_2.5.0_20180208 2018-02-06 280077 5d968841…
    s3l_2.5.0_20181109 2018-10-28 284712 d41b4a59…

    Testing. None of these has run with the package's modules. 267837 is still the only version proven with them, so whichever SDK version we pick has to stream on hardware before it merges. QEMU can't show this, because it doesn't model the DSP.

    I'd start with s3l_2.5.0_20181109, the newest, using the generic set, and fall back to 280077 if iav.ko and dsp.ko don't work with it. The microcode PR will come from our side, since the files come from the SDK.

    Could you run the candidate on your IP4M-1026E once that PR is up? The useful evidence is the same as in #2766: load_ucode's version line and the DSP entering its mode from power-on, plus stream 0 if your bring-up stack can get that far. If the fractional-rate problem you found at 29.97 fps behaves differently on this version, that would be useful to know too.

    ISP configuration: same rule. A configuration captured from stock firmware won't ship either, so it needs to come from an SDK release or your own tuning.

  3. DeathCamel58 commented on Nov 7, 2026

    @DeathCamel58
    Contributor

    Thanks, that settles it for me: SDK microcode, shipped in ambarella-osdrv-s3l, and proven on hardware before it merges.

    I've run #2782's 284712 set on the IP4M-1026E. The details are on that PR. In short, from a real power-on it reports ucode version 2018/10/28 284712.282649, enters DSP modes 0 and 1 with the package's modules, and streams stream 0 (2688×1512 H.264 at 20 fps). So the 280077 fallback shouldn't be needed. The one difference from 267837 is that statistics set up right after preview starts don't arrive until the setup is sent again, which I'll handle in the streamer.

    Understood on the ISP configuration too. What I use for testing comes from this unit's stock firmware and stays local, so the shipped one will need to come from an SDK release or our own tuning.

  4. openipc-ai commented on Nov 7, 2026

    @openipc-ai
    CollaboratorAuthor

    @DeathCamel58 thanks, that's the run this needed, and more than I'd asked for: a real power-on, both DSP modes, the version read back, and a decoded stream. Your results on #2782 meet the merge condition for s3l_2.5.0_20181109, so 284712 is the version and the 280077 fallback is dropped. I've updated the description here and the PR.

    I've read that evidence but not reproduced it, since I have no OV4689 board. A few things it leaves open:

    • 20 fps: ffprobe shows 20/1. Is that your streamer's setting, or does 267837 run faster on the same image? If this version limits the rate, that's worth knowing before it ships.
    • Boot path: the run was a netboot with an initramfs and the DTB from ambarella: s3l: Amcrest IP4M-1026E, with the board DTB appended to the uImage linux#178, so booting from flash with this microcode is untested. I don't see that as specific to this PR, and it'll come up once the board DTB and overlayfs are in.
    • Not tested: 29.97 fps VIN and the encode_only set, as you said. The PR ships only the generic set, so encode_only doesn't matter here.

    Statistics: agreed, that belongs in the streamer, and it's not a blocker for the PR. Thanks for writing it up.

    Logging the version in load_ambarella: good idea. I'd do it as a small separate PR, so #2782 stays exactly what you tested.

    ISP configuration: thanks, that's the right way to handle it.

  5. DeathCamel58 commented on Nov 7, 2026

    @DeathCamel58
    Contributor

    20 fps was my streamer's setting (fps: 20 in its config), not a limit of the microcode. I set it to 30 and compared both versions on the same image, netbooted, with only the microcode swapped:

    284712 (SDK) 267837 (stock)
    calc_dsp_fps dsp_fps 30000 dsp_fps 30000
    vcap / venc interrupts per second 30 / 30 30 / 30
    RTSP avg_frame_rate 30/1 30/1
    packets received in 10 s 301 301

    So no difference at 30 fps.

    Boot path: agreed. I'll run it from flash once the board's profile is up, which needs #2781 for the overlay.

    Statistics: I found the cause, and it may matter for Majestic on S3L (#2785) too.

    • A static comparison of the microcode builds shows that from 279928 on (which includes 284712, but not 267837), the DSP only sets up the 3A statistics buffers if statistics are enabled when preview starts. But AAA_STATISTICS_SETUP can only be sent once preview has started.
    • So the first preview after the microcode is loaded never delivers statistics, however often they're set up, and every later preview does. That matches what I measured.
    • My Divinus backend (not upstream yet) works around it: if no statistics arrive within 2 s of the first preview, it goes back to idle and starts preview again, before encoding. That's once per boot, about 2.5 s.
    • A streamer that enables statistics after starting preview the first time after boot would run that whole first session on 284712 with no statistics, so 3A would get nothing until it's restarted.
  6. openipc-ai commented on Nov 7, 2026

    @openipc-ai
    CollaboratorAuthor

    @DeathCamel58 thanks, that closes the frame-rate question, and the statistics finding is really useful.

    20 fps: closed. 284712 and 267837 match at 30 fps, so nothing is needed there.

    Boot path: that works. Note that #2781 is still waiting on the pasted evidence and uImage size from my review, and it needs a rebase to get an S3L build, now that CI builds s3l_lite (#2783).

    Statistics: this may well affect Majestic on s3l_lite, and the test we have doesn't rule it out. The S3Lm + AR0237 run in #2785 started Majestic after the vendor's stack had already run a preview, so its preview was never the first one after a microcode load. By your analysis, that's the only case that fails. So Majestic's first session after a cold boot on an s3l_lite image is untested, and that's now what the images ship: #2782 and #2785 are both merged.

    I haven't reproduced this or checked the static comparison myself, so for now I'm treating it as your measurement plus a likely risk.

    If you have time, this test would settle it, since the IP4M-1026E is the board that can run it. On a current s3l_lite with Majestic, from a real power-on:

    1. Does 3A run in the first session? Does the exposure settle, or does the picture stay at the sensor's power-on exposure?
    2. Does restarting Majestic change that, with the DSP still up?

    Majestic has no OV4689 tuning proven on this board as far as I know, so if 3A won't start at all, please paste that log too. That would be a different problem from this one, and it would need sorting out first.

    Your Divinus workaround is a useful data point: one return to idle and a new preview, about 2.5 s once per boot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions