Skip to content

portable: remove stray installer URL from IAR TrustZone non-secure ports - #1492

Open
sekior11 wants to merge 1 commit into
FreeRTOS:mainfrom
sekior11:fix/iar-ns-portasm-stray-url
Open

portable: remove stray installer URL from IAR TrustZone non-secure ports#1492
sekior11 wants to merge 1 commit into
FreeRTOS:mainfrom
sekior11:fix/iar-ns-portasm-stray-url

Conversation

@sekior11

Copy link
Copy Markdown

Problem

A stray IAR installer download URL sits outside the comment delimiters in the
restore_special_regs section of the IAR TrustZone non-secure ports:

        ldmia r2!, {r0, r3, lr}             http://files.iar.com/ftp/pub/box/bxarm-9.60.3.deb/* Read from stack - r0 = xSecureContext, r3 = PSPLIM and LR restored. */

Because /* appears after the URL, the assembler reads the bare URL as an operand
of the preceding ldmia and aborts:

Error: garbage following instruction -- `ldmia r2!,{r0,r3,lr} http:'

Note the line sits outside the #if ( configENABLE_PAC == 1 ) block (which ends
on the preceding line), so it breaks every configuration of these ports, not only
PAC-enabled builds.

Scope

Issue #1480 reports this for portable/IAR/ARM_CM33/non_secure/portasm.s.

A tree-wide scan of main (8be86d4) finds the stray URL in 7 files, all at
line 476. #1485 fixes one of them; this PR fixes the remaining six, so the two PRs
form a clean 1 + 6 partition with no file overlap and may merge in either order.
The six files:

  • portable/ARMv8M/non_secure/portable/IAR/ARM_CM33/portasm.s
  • portable/IAR/ARM_CM35P/non_secure/portasm.s
  • portable/IAR/ARM_CM52/non_secure/portasm.s
  • portable/IAR/ARM_CM55/non_secure/portasm.s
  • portable/IAR/ARM_CM85/non_secure/portasm.s
  • portable/IAR/ARM_STAR_MC3/non_secure/portasm.s

portable/IAR/ARM_CM33/non_secure/portasm.s is intentionally excluded because
#1485 already addresses it.

Note there are two distinct CM33 assembly files in the tree, both affected, and they
are easy to confuse:

path covered by
portable/IAR/ARM_CM33/non_secure/portasm.s #1485
portable/ARMv8M/non_secure/portable/IAR/ARM_CM33/portasm.s this PR

Fix

The stray URL is deleted, and the comment keeps its original text and column alignment:

-        ldmia r2!, {r0, r3, lr}             http://files.iar.com/ftp/pub/box/bxarm-9.60.3.deb/* Read from stack - r0 = xSecureContext, r3 = PSPLIM and LR restored. */
+        ldmia r2!, {r0, r3, lr}             /* Read from stack - r0 = xSecureContext, r3 = PSPLIM and LR restored. */

This matches the unaffected sibling port portable/IAR/ARM_CM23/non_secure/portasm.s
(line 444), which carries the same comment text without any URL. Optionally the URL
could be kept inside the comment instead, as #1485 does — either form assembles; I
removed it because it is a meaningless installer link.

Origin

Commit 78e0cc7 ("ARMv8.1-M: Add task dedicated PAC key support", #1195) introduced the
URL into CM33, CM35P, CM55, CM85 and the ARMv8M non-secure port. The CM52 (#1334) and
STAR-MC3 (#1363) ports were later created from an already-affected portasm.s and
inherited it.

Verification

Assembled with arm-none-eabi-gcc 13.3.1 20240614 (GNU Tools for STM32 13.3.rel1).
IAR's own directives (PUBLIC / EXTERN / SECTION / THUMB / END) were translated
1:1 to GNU equivalents so that the only difference between the "before" and "after"
inputs is the one comment line, making the result attributable to it.

Baseline (known-good sibling, proves the harness accepts a healthy file):

portable/IAR/ARM_CM23/non_secure/portasm.s   ->  assembles OK

All six files in this PR:

file before after
portable/IAR/ARM_CM35P/non_secure/portasm.s assembler error assembles OK
portable/IAR/ARM_CM52/non_secure/portasm.s assembler error assembles OK
portable/IAR/ARM_CM55/non_secure/portasm.s assembler error assembles OK
portable/IAR/ARM_CM85/non_secure/portasm.s assembler error assembles OK
portable/IAR/ARM_STAR_MC3/non_secure/portasm.s assembler error assembles OK
portable/ARMv8M/non_secure/portable/IAR/ARM_CM33/portasm.s assembler error assembles OK
RESULT: 6/6 files assemble cleanly, 0 stray URLs remaining.

Caveat, stated plainly: the check ran on GNU as, not on IAR iccarm (no IAR
licence available here). Both reject a bare token after an instruction, and the
reporter of #1480 reproduced the failure on IAR ARM 9.70.2, so the defect and the fix
are cross-confirmed — but this is not an IAR build.

Note on CI

.github/workflows/kernel-demos.yml only builds the CORTEX_MPS2_QEMU_IAR_GCC demo,
which is compiled with GCC. The IAR ports are not built by CI at all, which is how this
slipped through. Adding an assembler-only syntax check for these ports would be a
separate, larger change — happy to look at it if you think it is worth doing.

Relates to #1480.

A stray IAR installer download URL was left outside the comment delimiters
in the restore_special_regs section of the IAR TrustZone non-secure ports.
The assembler parses the bare URL as an operand of the preceding ldmia, so
any build of these ports aborts with:

    Error: garbage following instruction -- 'ldmia r2!,{r0,r3,lr} http:'

The line is outside the configENABLE_PAC conditional block, so it breaks
every configuration of the port, not only PAC-enabled builds.

Commit 78e0cc7 ("ARMv8.1-M: Add task dedicated PAC key support", FreeRTOS#1195)
introduced the URL in the CM33/CM35P/CM55/CM85 and ARMv8M non-secure
ports. The CM52 (FreeRTOS#1334) and STAR-MC3 (FreeRTOS#1363) ports inherited it when
their portasm.s was created from an already-affected file.

The stray URL is removed rather than moved inside the comment, matching
the unaffected sibling port ARM_CM23/non_secure/portasm.s, which carries
the same comment text without any URL.

Verified with arm-none-eabi-gcc 13.3.1: all six files fail to assemble
before the change and assemble cleanly after it.

Relates to FreeRTOS#1480. The ARM_CM33 non-secure port is handled separately by
FreeRTOS#1485, so it is intentionally not touched here.
@sekior11
sekior11 force-pushed the fix/iar-ns-portasm-stray-url branch from 8611557 to 2b4dfaf Compare September 14, 2026 09:29
@sonarqubecloud

Copy link
Copy Markdown

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants