#4845 closed defect (fixed)

Global variable declared/defined in the wrong file

Reported by: Daniel Páscoa Owned by: Sebastian Huber <sebastian.huber@…>
Priority: normal Milestone: 6.1
Component: arch/sparc Version: 6
Severity: normal Keywords: qualification
Cc: Blocked By:
Blocking:

Description

This source file contains both declaration and definition of the variable. It is recommended to declare global variables in a header file and define them in separate source files. Please consider this best practice and move the declarations to a header file and corresponding definitions to respective source files.

Additional Notes:
LEON3_Boot_Cpu is a global variable and only used by start.S file. And as such cannot be declared as static. Because is used in an assembly file there was no need to declare it as external. But the global variable is in fact declared and defined in same file.

This ticket was raised as an outcome of the Independent SW Verification and Validation (ISVV) for ESA-promoted RTEMS SMP Qualification Data Packs (https://rtems-qual.io.esa.int). Original ISVV reference for this issue is RTEMS-SMP-CODE-VER-043.

File list:
bsps\sparc\leon3\start\bspstart.c (line 54)

Change History (2)

comment:1 Changed on 02/10/23 at 15:01:13 by Sebastian Huber <sebastian.huber@…>

Owner: set to Sebastian Huber <sebastian.huber@…>
Resolution: fixed
Status: newclosed

In b993111/rtems:

bsp/leon3: Move SMP data to start.S

The LEON3_Boot_Cpu global object is only used by start.S. Move the definition
of this object to start.S and use a local symbol .Lbootcpuindex for it.

Use a compare-and-swap instruction to assign the boot CPU. This allows a
concurrent initialization.

Close #4845.

comment:2 Changed on 02/10/23 at 15:01:47 by Sebastian Huber

Component: adminarch/sparc
Milestone: 6.1
Note: See TracTickets for help on using tickets.