Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tools/build/elf_sanity.py #764

Merged
merged 7 commits into from
May 4, 2021
Merged

Conversation

jonasdn
Copy link
Contributor

@jonasdn jonasdn commented Apr 27, 2021

This script uses pyelftools to check the elf output file.

In this first version it will make sure that the added parameters are
not duplicates and does not exceed the max length of 25 characters.

This is hard to do in compile-time with macro magic.

@jonasdn jonasdn force-pushed the jonasdn/elf_sanity branch 2 times, most recently from 8440885 to 76b950e Compare April 27, 2021 12:32
This script uses pyelftools to check the elf output file.

In this first version it will make sure that the added parameters are
not duplicates and does not exceed the max length of 25 characters.

This is hard to do in compile-time with macro magic.
@krichardsson
Copy link
Contributor

Nice!
I think it should be added to the master build script tools/build/build to run it in CI and so on as well.

@krichardsson
Copy link
Contributor

We have long discussed some form of documentation of log and params, could an extension of this functionality possibly be a part of that? For instance generating lists of logs and params to be able to see what is available and what has been added/removed between releases?

@jonasdn jonasdn added this to the next-release milestone Apr 28, 2021
This will list parameters with type, in alpabetical order.

```
$ python3 tools/build/elf_sanity.py --list-params cf2.elf
activeMarker.back               PARAM_UINT8
activeMarker.front              PARAM_UINT8
activeMarker.left               PARAM_UINT8
activeMarker.mode               PARAM_UINT8
activeMarker.poll               PARAM_UINT8
activeMarker.right              PARAM_UINT8
cmdrCPPM.angPitch               PARAM_FLOAT
cmdrCPPM.angRoll                PARAM_FLOAT
cmdrCPPM.ratePitch              PARAM_FLOAT
cmdrCPPM.rateRoll               PARAM_FLOAT
cmdrCPPM.rateYaw                PARAM_FLOAT
colAv.bboxMaxX                  PARAM_FLOAT
colAv.bboxMaxY                  PARAM_FLOAT
colAv.bboxMaxZ                  PARAM_FLOAT
colAv.bboxMinX                  PARAM_FLOAT
colAv.bboxMinY                  PARAM_FLOAT
colAv.bboxMinZ                  PARAM_FLOAT
colAv.ellipsoidX                PARAM_FLOAT
colAv.ellipsoidY                PARAM_FLOAT
colAv.ellipsoidZ                PARAM_FLOAT
colAv.enable                    PARAM_UINT8
colAv.horizon                   PARAM_FLOAT
colAv.maxPeerLocAge             PARAM_INT32
colAv.maxSpeed                  PARAM_FLOAT
colAv.sidestepThrsh             PARAM_FLOAT
colAv.vorIters                  PARAM_INT32
colAv.vorTol                    PARAM_FLOAT
commander.enHighLevel           PARAM_UINT8
controller.tiltComp             PARAM_UINT8
cpu.flash                       PARAM_UIN16 | PARAM_RONLY
cpu.id0                         PARAM_UINT32 | PARAM_RONLY
cpu.id1                         PARAM_UINT32 | PARAM_RONLY
cpu.id2                         PARAM_UINT32 | PARAM_RONLY
crtpsrv.echoDelay               PARAM_UIN16
ctrlINDI.act_dyn_p              PARAM_FLOAT
ctrlINDI.act_dyn_q              PARAM_FLOAT
ctrlINDI.act_dyn_r              PARAM_FLOAT
ctrlINDI.bound_ctrl_input       PARAM_FLOAT
ctrlINDI.filt_cutoff            PARAM_FLOAT
ctrlINDI.filt_cutoff_r          PARAM_FLOAT
ctrlINDI.g1_p                   PARAM_FLOAT
ctrlINDI.g1_q                   PARAM_FLOAT
ctrlINDI.g1_r                   PARAM_FLOAT
ctrlINDI.g2                     PARAM_FLOAT
ctrlINDI.outerLoopActive        PARAM_UINT8
ctrlINDI.pitch_kp               PARAM_FLOAT
ctrlINDI.ref_err_p              PARAM_FLOAT
ctrlINDI.ref_err_q              PARAM_FLOAT
ctrlINDI.ref_err_r              PARAM_FLOAT
ctrlINDI.ref_rate_p             PARAM_FLOAT
ctrlINDI.ref_rate_q             PARAM_FLOAT
ctrlINDI.ref_rate_r             PARAM_FLOAT
ctrlINDI.roll_kp                PARAM_FLOAT
ctrlINDI.thrust_threshold       PARAM_FLOAT
ctrlINDI.yaw_kp                 PARAM_FLOAT
ctrlMel.i_range_m_xy            PARAM_FLOAT
ctrlMel.i_range_m_z             PARAM_FLOAT
ctrlMel.i_range_xy              PARAM_FLOAT
ctrlMel.i_range_z               PARAM_FLOAT
ctrlMel.kR_xy                   PARAM_FLOAT
ctrlMel.kR_z                    PARAM_FLOAT
ctrlMel.kd_omega_rp             PARAM_FLOAT
ctrlMel.kd_xy                   PARAM_FLOAT
ctrlMel.kd_z                    PARAM_FLOAT
ctrlMel.ki_m_xy                 PARAM_FLOAT
ctrlMel.ki_m_z                  PARAM_FLOAT
ctrlMel.ki_xy                   PARAM_FLOAT
ctrlMel.ki_z                    PARAM_FLOAT
ctrlMel.kp_xy                   PARAM_FLOAT
ctrlMel.kp_z                    PARAM_FLOAT
ctrlMel.kw_xy                   PARAM_FLOAT
ctrlMel.kw_z                    PARAM_FLOAT
ctrlMel.mass                    PARAM_FLOAT
ctrlMel.massThrust              PARAM_FLOAT
deck.bcAIDeck                   PARAM_UINT8 | PARAM_RONLY
deck.bcBuzzer                   PARAM_UINT8 | PARAM_RONLY
deck.bcCPPM                     PARAM_UINT8 | PARAM_RONLY
deck.bcDWM1000                  PARAM_UINT8 | PARAM_RONLY
deck.bcFlow                     PARAM_UINT8 | PARAM_RONLY
deck.bcFlow2                    PARAM_UINT8 | PARAM_RONLY
deck.bcGTGPS                    PARAM_UINT8 | PARAM_RONLY
deck.bcLedRing                  PARAM_UINT8 | PARAM_RONLY
deck.bcLighthouse4              PARAM_UINT8 | PARAM_RONLY
deck.bcMultiranger              PARAM_UINT8 | PARAM_RONLY
deck.bcOA                       PARAM_UINT8 | PARAM_RONLY
deck.bcUSD                      PARAM_UINT8 | PARAM_RONLY
deck.bcZRanger                  PARAM_UINT8 | PARAM_RONLY
deck.bcZRanger2                 PARAM_UINT8 | PARAM_RONLY
firmware.modified               PARAM_UINT8 | PARAM_RONLY
firmware.revision0              PARAM_UINT32 | PARAM_RONLY
firmware.revision1              PARAM_UIN16 | PARAM_RONLY
flightmode.althold              PARAM_UINT8
flightmode.posSet               PARAM_UINT8
flightmode.poshold              PARAM_UINT8
flightmode.stabModePitch        PARAM_UINT8
flightmode.stabModeRoll         PARAM_UINT8
flightmode.stabModeYaw          PARAM_UINT8
flightmode.yawMode              PARAM_UINT8
flightmode.yawRst               PARAM_UINT8
health.startBatTest             PARAM_UINT8
health.startPropTest            PARAM_UINT8
hlCommander.vland               PARAM_FLOAT
hlCommander.vtoff               PARAM_FLOAT
imu_sensors.BMP388              PARAM_UINT8 | PARAM_RONLY
imu_sensors.HMC5883L            PARAM_UINT8 | PARAM_RONLY
imu_sensors.MS5611              PARAM_UINT8 | PARAM_RONLY
imu_tests.HMC5883L              PARAM_UINT8 | PARAM_RONLY
imu_tests.MPU6500               PARAM_UINT8 | PARAM_RONLY
imu_tests.MS5611                PARAM_UINT8 | PARAM_RONLY
kalman.initialX                 PARAM_FLOAT
kalman.initialY                 PARAM_FLOAT
kalman.initialYaw               PARAM_FLOAT
kalman.initialZ                 PARAM_FLOAT
kalman.mNBaro                   PARAM_FLOAT
kalman.mNGyro_rollpitch         PARAM_FLOAT
kalman.mNGyro_yaw               PARAM_FLOAT
kalman.maxPos                   PARAM_FLOAT
kalman.maxVel                   PARAM_FLOAT
kalman.pNAcc_xy                 PARAM_FLOAT
kalman.pNAcc_z                  PARAM_FLOAT
kalman.pNAtt                    PARAM_FLOAT
kalman.pNPos                    PARAM_FLOAT
kalman.pNVel                    PARAM_FLOAT
kalman.quadIsFlying             PARAM_UINT8
kalman.resetEstimation          PARAM_UINT8
kalman.robustTdoa               PARAM_UINT8
kalman.robustTwr                PARAM_UINT8
lighthouse.bsCalibReset         PARAM_UINT8
lighthouse.method               PARAM_UINT8
lighthouse.sweepStd             PARAM_FLOAT
lighthouse.sweepStd2            PARAM_FLOAT
lighthouse.systemType           PARAM_UINT8
locSrv.enLhAngleStream          PARAM_UINT8
locSrv.enRangeStreamFP32        PARAM_UINT8
locSrv.extPosStdDev             PARAM_FLOAT
locSrv.extQuatStdDev            PARAM_FLOAT
loco.mode                       PARAM_UINT8
memTst.resetW                   PARAM_UINT8
motion.adaptive                 PARAM_UINT8
motion.disable                  PARAM_UINT8
motion.flowStdFixed             PARAM_FLOAT
motorPowerSet.enable            PARAM_UINT8
motorPowerSet.m1                PARAM_UIN16
motorPowerSet.m2                PARAM_UIN16
motorPowerSet.m3                PARAM_UIN16
motorPowerSet.m4                PARAM_UIN16
pid_attitude.pitch_kd           PARAM_FLOAT
pid_attitude.pitch_ki           PARAM_FLOAT
pid_attitude.pitch_kp           PARAM_FLOAT
pid_attitude.roll_kd            PARAM_FLOAT
pid_attitude.roll_ki            PARAM_FLOAT
pid_attitude.roll_kp            PARAM_FLOAT
pid_attitude.yaw_kd             PARAM_FLOAT
pid_attitude.yaw_ki             PARAM_FLOAT
pid_attitude.yaw_kp             PARAM_FLOAT
pid_rate.pitch_kd               PARAM_FLOAT
pid_rate.pitch_ki               PARAM_FLOAT
pid_rate.pitch_kp               PARAM_FLOAT
pid_rate.roll_kd                PARAM_FLOAT
pid_rate.roll_ki                PARAM_FLOAT
pid_rate.roll_kp                PARAM_FLOAT
pid_rate.yaw_kd                 PARAM_FLOAT
pid_rate.yaw_ki                 PARAM_FLOAT
pid_rate.yaw_kp                 PARAM_FLOAT
posCtlPid.rpLimit               PARAM_FLOAT
posCtlPid.thrustBase            PARAM_UIN16
posCtlPid.thrustMin             PARAM_UIN16
posCtlPid.xKd                   PARAM_FLOAT
posCtlPid.xKi                   PARAM_FLOAT
posCtlPid.xKp                   PARAM_FLOAT
posCtlPid.xyVelMax              PARAM_FLOAT
posCtlPid.yKd                   PARAM_FLOAT
posCtlPid.yKi                   PARAM_FLOAT
posCtlPid.yKp                   PARAM_FLOAT
posCtlPid.zKd                   PARAM_FLOAT
posCtlPid.zKi                   PARAM_FLOAT
posCtlPid.zKp                   PARAM_FLOAT
posCtlPid.zVelMax               PARAM_FLOAT
posCtrlIndi.K_dxi_x             PARAM_FLOAT
posCtrlIndi.K_dxi_y             PARAM_FLOAT
posCtrlIndi.K_dxi_z             PARAM_FLOAT
posCtrlIndi.K_xi_x              PARAM_FLOAT
posCtrlIndi.K_xi_y              PARAM_FLOAT
posCtrlIndi.K_xi_z              PARAM_FLOAT
posEstAlt.estAlphaAsl           PARAM_FLOAT
posEstAlt.estAlphaZr            PARAM_FLOAT
posEstAlt.vAccDeadband          PARAM_FLOAT
posEstAlt.velFactor             PARAM_FLOAT
posEstAlt.velZAlpha             PARAM_FLOAT
powerDist.idleThrust            PARAM_UINT32
ring.effect                     PARAM_UINT8
ring.emptyCharge                PARAM_FLOAT
ring.fadeColor                  PARAM_UINT32
ring.fadeTime                   PARAM_FLOAT
ring.fullCharge                 PARAM_FLOAT
ring.glowstep                   PARAM_FLOAT
ring.headlightEnable            PARAM_UINT8
ring.neffect                    PARAM_UINT32 | PARAM_RONLY
ring.solidBlue                  PARAM_UINT8
ring.solidGreen                 PARAM_UINT8
ring.solidRed                   PARAM_UINT8
sensfusion6.baseZacc            PARAM_FLOAT
sensfusion6.ki                  PARAM_FLOAT
sensfusion6.kp                  PARAM_FLOAT
sound.effect                    PARAM_UINT8
sound.freq                      PARAM_UIN16
sound.neffect                   PARAM_UINT32 | PARAM_RONLY
sound.ratio                     PARAM_UINT8
stabilizer.controller           PARAM_UINT8
stabilizer.estimator            PARAM_UINT8
stabilizer.stop                 PARAM_UINT8
system.forceArm                 PARAM_INT8
system.highlight                PARAM_UINT8
system.selftestPassed           PARAM_INT8 | PARAM_RONLY
system.taskDump                 PARAM_UINT8
tdoaEngine.logId                PARAM_UINT8
tdoaEngine.logOthrId            PARAM_UINT8
tdoaEngine.matchAlgo            PARAM_UINT8
usd.canLog                      PARAM_UINT8 | PARAM_RONLY
usd.logging                     PARAM_UINT8
velCtlPid.vxKd                  PARAM_FLOAT
velCtlPid.vxKi                  PARAM_FLOAT
velCtlPid.vxKp                  PARAM_FLOAT
velCtlPid.vyKd                  PARAM_FLOAT
velCtlPid.vyKi                  PARAM_FLOAT
velCtlPid.vyKp                  PARAM_FLOAT
velCtlPid.vzKd                  PARAM_FLOAT
velCtlPid.vzKi                  PARAM_FLOAT
velCtlPid.vzKp                  PARAM_FLOAT
```
@jonasdn jonasdn force-pushed the jonasdn/elf_sanity branch from d0ca74f to 9399192 Compare April 29, 2021 08:32
@jonasdn
Copy link
Contributor Author

jonasdn commented Apr 30, 2021

We have long discussed some form of documentation of log and params, could an extension of this functionality possibly be a part of that? For instance generating lists of logs and params to be able to see what is available and what has been added/removed between releases?

This is possible, the what and how should be discussed.

@jonasdn jonasdn force-pushed the jonasdn/elf_sanity branch from bb2a655 to 3a365f1 Compare April 30, 2021 04:24
@ataffanel
Copy link
Member

This is a long needed addition. Looks great!

@ataffanel ataffanel merged commit ec465ce into bitcraze:master May 4, 2021
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.

Prevent multiple PARAM_GROUP_START definitions of same name
3 participants