-
-
Notifications
You must be signed in to change notification settings - Fork 19.2k
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
Flash leveling for some STM32 boards (and more later?) #16174
Flash leveling for some STM32 boards (and more later?) #16174
Conversation
Note that we only write the differences when writing to EEPROM. |
// Look to see if we have any data stored yet, and where | ||
uint32_t address = FLASH_ADDRESS_START; | ||
while (address < FLASH_ADDRESS_END) { | ||
uint32_t address_value = (*(__IO uint32_t*)address); | ||
if (address_value != EMPTY_UINT32) { | ||
current_slot = (address - FLASH_ADDRESS_START) / EEPROM_SIZE; | ||
break; | ||
} | ||
address += sizeof(uint32_t); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't looked back at what the LPC code does, but do we need to check every uint32_t value to find the first unused one? Could one single location in each slot be checked? I suppose it is possible to have only UBL meshes saved, without ever saving EEPROM configuration, so that might be tricked than it sounds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally the last word written (in time, not necessary location) in each slot would be a "valid" indicator, that could be used to ensure a slot is only used if it was written completely. That would allow ignoring a corrupt slot, where power was lost while writing the flash. That of course could not protect you when the entire sector is erased. More than one sector would be needed to provide fault tolerance in that case.
It probably doesn't make sense to tie up this feature for that, unless it could already be easily implemented without requiring EEPROM layout changes that would result in issues elsewhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ignoring a corrupt slot
If you chose to implement this it would also add complexity where you'd have to skip corrupt slots when choosing your destination, rather than simply rolling to the next slot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't looked back at what the LPC code does, but do we need to check every uint32_t value to find the first unused one? Could one single location in each slot be checked? I suppose it is possible to have only UBL meshes saved, without ever saving EEPROM configuration, so that might be tricked than it sounds.
The configuration in the 4k buffer is offset by 100, with the print counter information stored before it. We could, probably look around offset 100 where it stores the checksum.
The LPC code calls a blanksector function and doesn't have that type of loop inside the HAL. I can dig into that function and check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing that'll make things tricky is if we adapt this code across the other chips. The sector concept of the F4 chips, where they have 8 to 12 "blocks" between 16k and 128k is easy to work with because we can use one "sector" and subdivide.
The F103 chips, which currently uses a completely different HAL for now, uses a "page" concept. Only difference is the number and size. Instead of subdividing what I'll just call a flash "unit" into multiple slots, we'd have to subdivide a slot into multiple units (or pages).
The datasheets show chips with pages of 1, 2, and 4k. It could get convoluted quickly.
Would we want to get more variations of these STM32 chips supported with this type of wear leveling and then add the corruption check add it first?
That is not an option with flash. You can't set bits when you write to flash. You have to erase the page/sector to set all the bits, and writes can only clear them. That's where the real value in this change comes in, since it will reduce the erase frequency on an SKR Pro by 32x. |
I have read something about maybe combining the STM32 HALs. Is that on a roadmap, or just something that will happen later.
I keep talking about supporting other variations of the STM32 chips but my changes have only been applied to Thoughts path forward? Keep this PR small and only apply it, as I have, to those specific chips? A generic approach in a single file will get ugly fast. Is there precedence/example of having the logic in the same HAL but in different files? Aside: I have an F103 device coming, so I will play around with leveling for that but that code, for now, will go in |
I don’t think anything currently functions I. The F4_F7 HAL, and those boards need to move into the STM32 HAL. Rumba32 currently uses the STM32 HAL. It is easy not to notice because they build from Arduino IDE. The F1 HAL is already widely used, and I think it is less certain whether they should move to the shared HAL. As for whether wear leveling would be implemented for F1 chips, you probably wouldn’t want to do more than swap between two locations, due to the small page size. |
Pushed a few changes
Thoughts on changes 3 and 7? I need to do more in depth testing. It passes some quick smoke tests, but I haven't tried it with mesh data yet. |
Changes look good to me. If this isn't blowing up anything then it should be safe to merge for wider testing. |
It'll be a bit longer before my printer is back together and I am actually using my SKR PRO 1.1. It wasn't blowing anything up when I was bench testing the code. The fact that, for now, it is an opt in option |
It's important that we preserve the ability to compile for STM32 in Arduino IDE. The status of this capability needs a review. |
The temporary SoftwareSerial implementation I added prevents building from Arduino, since I don't think there is any way to instruct it to exclude the SoftwareSerial library. The need for our own copy should go away when Arduino_Core_STM32 1.8 releases. I think that is supposed to be this month sometime. I wasn't able to find any preprocessor constant which would tell us we are building inside Arduino. Maybe it exists, but for now the workaround if you don't need SoftwareSerial is just to delete the SoftwareSerial.cpp file from our own HAL folder. I believe the Rumba2 is more built for SPI-enabled drivers, so hopefully that is workable for now. |
Specifically, for the STM32 boards that Arduino IDE supports we were targeting the https://github.com/danieleff/STM32GENERIC platform as an alternative to https://github.com/stm32duino/Arduino_Core_STM32.
To skip compilation in Arduino IDE without deleting a file, either…
We can easily provide the second one, if needed. |
The instructions on the Rumba32 website have you install "STM32 Cores", which seems to correspond to Arduino_Core_STM32. There has been at least one issue opened regarding the SoftwareSerial conflict that made it clear that HAL_STM32 (which uses Arduino_Core_STM32) was being used for Rumba32. That is the only STM32 board I've head of anyone building inside Arduino, so I can't speak for the others.
This is what I was looking for and didn't find. Certainly we could easily add a DEFINE in the PIO ini file and use that. |
Although users are more savvy about PlatformIO, it would be great if users could choose Arduino IDE to build Marlin 2 targeting any of the 32-bit boards that Arduino IDE supports (some of which are STM32-based).
These are used in Marlin and only exist for PlatformIO…
|
Was the conversation more about my question about Thoughts on reversing the logic of |
I think we got a bit off topic with the Arduino discussion. It probably came up becaused I mentioned the Rumba32 using HAL_STM32. I posted PR #16266 to address the SoftwareSerial incompatibility I mentioned. I don't think any of the boards this benefits can be built inside Arduino, so I doubt you introduced problems for them. |
* [cron] Bump distribution date * STM32F1 Flash-based EEPROM fixes (MarlinFirmware#16118) * Disable PRINTCOUNTER in SKR Mini E3 examples (MarlinFirmware#16110) * Fix compile error with disabled PIDTEMP (MarlinFirmware#16108) * Wanhao D6 uses TINYBOY2 (MarlinFirmware#16117) * Improve touch buttons behavior (MarlinFirmware#16109) * Update AZSMZ LCD link (MarlinFirmware#16106) * [cron] Bump distribution date * Update 3DFabXYZ settings (MarlinFirmware#16139) * [cron] Bump distribution date * Fix controller and SD on Robin Nano (MarlinFirmware#16187) * Correct MKS Robin Mini pins (MarlinFirmware#16178) * Formalize DAC percent strings (MarlinFirmware#16176) * Update Italian language (MarlinFirmware#16147) * Update french (objects, retract...) * Superscript 3 for mm3 * [cron] Bump distribution date * Add MKS Robin Pro, MKS Robin Lite3 (MarlinFirmware#16163) * Fix multiple servos with STM32 (MarlinFirmware#16151) * Use error message !! hints (MarlinFirmware#16145) * Update BTT comments for USB/SD Composite (MarlinFirmware#16130) * MKS 12864 OLED pins for SGEN-L (MarlinFirmware#16188) * Invert E dir of Geeetech A10 (MarlinFirmware#16149) * Disable SD_CHECK_AND_RETRY in BTT E3 configs (MarlinFirmware#16143) * Add a CI test for RAMBo + CNC (MarlinFirmware#16126) * Onboard (always-on) pullups support (MarlinFirmware#16144) * Tweak ExtUI Probeless Babystepping (MarlinFirmware#16177) * Fix RAMBo CNC test * Flsun QQ-S example config (MarlinFirmware#16204) * Add MKS Robin Mini EEPROM defines (MarlinFirmware#16203) * Fix compile error (macro substitution typo) (MarlinFirmware#16194) * Update M503 MBL G29 report (MarlinFirmware#16199) * Include Z in SCARA steps feedrate (MarlinFirmware#16193) * Cardreader read/write open methods * Tweak some config names * Improve A20M config * Move status screen defines * Fix bad #ifdef (MarlinFirmware#16227) * TOUCH_MI_DEPLOY_XPOS fallback to X_MIN_POS (MarlinFirmware#16226) * Fix MKS SGen-L SD detect pin (MarlinFirmware#16224) * Improve ESP32 HAL (EEPROM, watchdog) (MarlinFirmware#16228) * Fix G28 debug line, M569 calls (MarlinFirmware#16213) * Add SKR Mini E3 + Zonestar LCD warning (MarlinFirmware#16214) * STM32 Touch UI timings, Longer onboard pullups (MarlinFirmware#16219) * Update BTT002 platform (fixing SD init) (MarlinFirmware#16217) * Define more FAN pins for GT2560 (MarlinFirmware#16235) * Tweak E180 config * Update product links * [cron] Bump distribution date * Add dev-2.1.x to 'mfinfo' script * Move AutoBuildMarlin to its own repo * [cron] Bump distribution date * Tweak G34, fix a declaration * Sanity-check Z_STEPPER_AUTO_ALIGN coordinates (MarlinFirmware#16231) * Improve SKR mini E3 + Ender 3 settings (MarlinFirmware#16247) * Tweak code formatting * Allow TMC2209 to save/restore spreadCycle (MarlinFirmware#16153) Co-Authored-By: teemuatlut <[email protected]> * Spindle/Laser pins for RADDS (MarlinFirmware#16119) * Improve pulse timing and step reliability (MarlinFirmware#16128) * BigTreeTech SKR v1.4 support (MarlinFirmware#16236) * Followup to TMC2209 spreadcycle patch * Remove obsolete TMC2209 comment * HOME_USING_SPREADCYCLE is obsolete Co-Authored-By: teemuatlut <[email protected]> * Use MYSERIAL0 (not SerialUSB) for Malyan LCD * Followup for step timing (MarlinFirmware#16128) * Fix broken M100_dump_routine * Tweak sanity checks * Update test scripts to error on unknown (MarlinFirmware#16229) * Kossel Clear configuration (MarlinFirmware#16198) * Move pins debug condition * Use Github Actions for CI, date bump (MarlinFirmware#16269) * Fix HAL_STM32 + Arduino IDE SoftwareSerial conflict (MarlinFirmware#16266) * Improve Anet A6 config (MarlinFirmware#16280) * Fix G34 with Z_DUAL_STEPPER_DRIVERS compile (MarlinFirmware#16274) * Fix planner compile error (MarlinFirmware#16272) * Fix axis CS sanity check (MarlinFirmware#16271) * Add Tevo Nereus (w/ Robin Nano) config (MarlinFirmware#16207) * Don't test certain changes * Reset runout.ran_out on resume (MarlinFirmware#16230) * Step timing cleanup and rounding fix (MarlinFirmware#16258) * Add MRR_ESPA/_ESPE (ESP32) boards (MarlinFirmware#16238) * Add Ender-5 Pro config (MarlinFirmware#16221) * Add FLYBOARD (STM32F407ZG) (MarlinFirmware#16257) * Fix STM32 flush of TX (used by UBL) (MarlinFirmware#16197) * Flash leveling (for some STM32) (MarlinFirmware#16174) * Some ESP32 patches (MarlinFirmware#16297) * MKS SGen-L pins EEBF or EFBF scheme (MarlinFirmware#16296) * Release version 2.0.0 * Add Rumba32 support for PIO (MarlinFirmware#16202) * MKS Robin 2 (STM32F407ZE) base support (MarlinFirmware#16270) * Update Czech language (MarlinFirmware#16305) * Sync SKR E3 configs (MarlinFirmware#16301) * Add NOZZLE_AS_PROBE (no probe offsets) (MarlinFirmware#15929) * Version 2.0.1 * Update build status url Co-authored-by: Scott Lahteine <[email protected]> Co-authored-by: randellhodges <[email protected]> Co-authored-by: Jason Smith <[email protected]> Co-authored-by: Antti Andreimann <[email protected]> Co-authored-by: thisiskeithb <[email protected]> Co-authored-by: Tanguy Pruvot <[email protected]> Co-authored-by: Luu Lac <[email protected]> Co-authored-by: Alain Martel <[email protected]> Co-authored-by: Anders Sahlman <[email protected]> Co-authored-by: dagorel <[email protected]> Co-authored-by: Giuliano Zaro <[email protected]> Co-authored-by: MS1987 <[email protected]> Co-authored-by: MangaValk <[email protected]> Co-authored-by: André Kjellstrup <[email protected]> Co-authored-by: Tobias Schürg <[email protected]> Co-authored-by: Jeff Eberl <[email protected]> Co-authored-by: ManuelMcLure <[email protected]> Co-authored-by: InsanityAutomation <[email protected]> Co-authored-by: iain MacDonnell <[email protected]> Co-authored-by: Bo Herrmannsen <[email protected]> Co-authored-by: Luc <[email protected]> Co-authored-by: danym21 <[email protected]> Co-authored-by: chzj333 <[email protected]> Co-authored-by: Vertabreaker <[email protected]> Co-authored-by: Moshi Binyamini <[email protected]> Co-authored-by: salami738 <[email protected]> Co-authored-by: elementfoundry <[email protected]> Co-authored-by: teemuatlut <[email protected]> Co-authored-by: Mario Costa <[email protected]> Co-authored-by: BigTreeTech <[email protected]> Co-authored-by: Markus Towara <[email protected]> Co-authored-by: FLYmaker <[email protected]> Co-authored-by: ferengi82 <[email protected]> Co-authored-by: petrzjunior <[email protected]>
* Don't test certain changes * Reset runout.ran_out on resume (MarlinFirmware#16230) * Step timing cleanup and rounding fix (MarlinFirmware#16258) * Add MRR_ESPA/_ESPE (ESP32) boards (MarlinFirmware#16238) * Add Ender-5 Pro config (MarlinFirmware#16221) * Add FLYBOARD (STM32F407ZG) (MarlinFirmware#16257) * Fix STM32 flush of TX (used by UBL) (MarlinFirmware#16197) * Flash leveling (for some STM32) (MarlinFirmware#16174) * Some ESP32 patches (MarlinFirmware#16297) * MKS SGen-L pins EEBF or EFBF scheme (MarlinFirmware#16296) * Add Rumba32 support for PIO (MarlinFirmware#16202) * MKS Robin 2 (STM32F407ZE) base support (MarlinFirmware#16270) * Update Czech language (MarlinFirmware#16305) * Sync SKR E3 configs (MarlinFirmware#16301) * Add NOZZLE_AS_PROBE (no probe offsets) (MarlinFirmware#15929) * Update README with status badge, etc. * Split up HAL items * Update mfpub for current MarlinDocumentation * Fix Max7219 with 256 or more cels * Fix games menu back item, titles * Update comments re: NOZZLE_AS_PROBE * Fix min limit for acc, feed, jerk (MarlinFirmware#16416) * Improve Renkforce configs (MarlinFirmware#16417) * Permit ENDSTOP_INTERRUPTS_FEATURE on more STM32 (MarlinFirmware#16412) * Improve STEVAL_3DP001V1 and future STEVAL_* support (MarlinFirmware#16404) * MKS Robin ILI9328 TFT support (MarlinFirmware#16401) * Disable PIDTEMPBED for SKR Mini E3 (MarlinFirmware#16396) * Return from loop() on non-AVR boards (MarlinFirmware#16390) * Refactor TMC-related macros and sanity checks (MarlinFirmware#16384) * Add FILAMENT_UNLOAD_PURGE_FEEDRATE (MarlinFirmware#16372) * Fix some DOGM warnings (MarlinFirmware#16363) * Fix warnings in stepper.cpp (MarlinFirmware#16364) * Fix PrintrBoard build (ignore TMC libraries) (MarlinFirmware#16346) (In future try to get Teensy processors better supported by `TMCStepper`.) * Clean up trailing whitespace * PWM pin not needed for Neopixel brightness / submenu (MarlinFirmware#16345) * Misc patches preceding DGUS PR * Fix Visual Micro "Arduino IDE for Visual Studio" support (MarlinFirmware#16418) * Update Russian language (MarlinFirmware#16426) * STM32F1: Fix misleading indent / nullptr on FSMC (MarlinFirmware#16431) * Z-offset edit precision based on value limits (MarlinFirmware#16425) * Add Ender-5 leadscrew README (MarlinFirmware#16424) * Add motherboard BIGTREE_SKR_V1.4_TURBO (MarlinFirmware#16374) * Enable MULTI_NOZZLE_DUPLICATION for BIBO (MarlinFirmware#16435) * Touch UI: Fix UBL mesh value editing (MarlinFirmware#16432) * Sidewinder X1 Config Updates (MarlinFirmware#16315) * Add Leapfrog Xeed 2015 support (MarlinFirmware#16400) * Improve JGAurora A1/A5S touch buttons (MarlinFirmware#16394) * Standardize drivers.h values, add class indirection (MarlinFirmware#16448) * Update Russian language (MarlinFirmware#16440) * BTT002: Add runout, PLR, and RGB pins (MarlinFirmware#16442) * Pins debugging AVR serial pins (MarlinFirmware#16437) * Fix MIN_PROBE_EDGE bug in default ABL G29 (MarlinFirmware#16367) * Temporary CI fix for STM32 * Use a default monitor_speed of 250000 * MSG_WATCH => MSG_INFO_SCREEN * Add EVNOVO (Artillery) Genius config (MarlinFirmware#16320) * Fixed Creality CR-20 Pro configuration example (MarlinFirmware#16332) * FYSETC F6 v1.4 board support (MarlinFirmware#16321) * Add example configs. Expand custom menu. (MarlinFirmware#16286) - Anet E10 - Geeetech D200 - Geeetech M201 - JGAurora Magic - MakerFarm Pegasus 12 * Fix Ender-2 display pins, add BTN_ENC (MarlinFirmware#16349) * Update and fix DGUS (MarlinFirmware#16317) * Fix serials available on SKR Pro 1.1 (MarlinFirmware#16439) * Fix daily date bump action * Action to check PRs * Update maintainer funding links * Skip build tests on forks * Update git helper usage * Fix EEPROM error with EXTRUDERS == 0 (MarlinFirmware#16464) * Fix M115 cap with EXTRUDERS == 0 (MarlinFirmware#16459) * Add option to invert joystick axes (MarlinFirmware#16466) * Update Russian language (MarlinFirmware#16461) * Fix permyriad progress bar (MarlinFirmware#16460) * Improve French language (UBL) (MarlinFirmware#16453) * Followup to EEPROM patch (MarlinFirmware#16470) * Remove extra UBL map edit menu item (MarlinFirmware#16451) * Fix unused var warning (MarlinFirmware#16467) * Update U20 config to help UBL toggle (MarlinFirmware#16471) * Move auto_build.py to 'vscode' folder * Fix MKS_SGEN sanity check (MarlinFirmware#16501) * Fix EEPROM array size bug (MarlinFirmware#16475) * Fix SKR Pro BLTouch conflicting timers (MarlinFirmware#16499) * Provide some missing Arduino macros (MarlinFirmware#16497) * Fix Change Filament menu item with runout (MarlinFirmware#16485) * Fix LCD for Tevo Tornado (MarlinFirmware#16474) * Update workflow skip condition * Add menu item Tune > Advance K (MarlinFirmware#16488) * Extend SERIAL_CHAR to take multiple arguments * Code style and comment tweaks * Correct ESP32 CPU speed in README (MarlinFirmware#16472) * Add ARC_SEGMENTS_PER_SEC for finer G2/G3 arcs (MarlinFirmware#16510) * Fix compile error w/out LCD (MarlinFirmware#16502) * Add Probe Offsets menu (MarlinFirmware#16444) * Fix Probe Offset XY edit items (et Français) (MarlinFirmware#16523) * Update Russian language (MarlinFirmware#16522) * [cron] Bump distribution date (2020-01-10) * Prevent Z misaligment on tool change (MarlinFirmware#16518) * Update Italian language (MarlinFirmware#16527) * ESP3d integration for ESP32 (MarlinFirmware#16515) * [cron] Bump distribution date (2020-01-11) * Migrate actions to default (2.0.x) branch * Only constrain motion on homed axes (MarlinFirmware#16533) Co-authored-by: Scott Lahteine <[email protected]> * Fix probeless delta build (MarlinFirmware#16537) * Use RECIPROCAL macro (not _RECIP) (MarlinFirmware#16530) * [cron] Bump distribution date (2020-01-12) * Restore test_builds action to bugfix * Update auto_build.py paths for Atom/Sublime * [cron] Bump distribution date (2020-01-13) * Add GTM32 (STM32F103VET6) environment (MarlinFirmware#16454) * Power options formatting * Geeetech G2Pro configuration (MarlinFirmware#16553) * Fix Linux upload path detection (MarlinFirmware#16514) * Add SERVO, TONE timers to variant for better STEVAL_3DP001V1 support (MarlinFirmware#16538) * Clean up whitespace * [cron] Bump distribution date (2020-01-14) * Improved STMicro L64XX stepper driver support (MarlinFirmware#16452) * Make lcd_power_loss_recovery_cancel exportable * Fix PLR cancel with ExtUI (MarlinFirmware#16556) * Bring MP_SCARA config up to date * Fix Fysetc S6 FLASH_PAGE_SIZE and test build (MarlinFirmware#16560) * [cron] Bump distribution date (2020-01-15) * Update more configs * Move configurations to a separate repo * Fix build error with unsupported reset flags (MarlinFirmware#16562) * Steval_3DP001V1 timers, analog inputs, etc. (MarlinFirmware#16565) * Use Flash EEPROM on BTT002 (MarlinFirmware#16558) * Get test configs from GitHub * Fix typo * Nikon IR support for time lapse photos (MarlinFirmware#16539) * Adjustable ADC debounce delay (MarlinFirmware#16264) * [cron] Bump distribution date (2020-01-16) * STM32 RODATA LENGTH (MarlinFirmware#16580) * Fix I2C address of MCP4728 on LPC176x (MarlinFirmware#16578) * Fix GTM32 environment (to prevent a crash) * Fix some warnings, Melzi pins * Move macros to stepper/indirection * Fix TOUCH_UI_FTDI_EVE bugs (MarlinFirmware#16540) * ESP32 HAL: Fix random pauses during prints (MarlinFirmware#16548) * [cron] Bump distribution date (2020-01-17) * STM32 soft SPI. STEVAL_3DP001V1 SD read. M906 tweaks. (MarlinFirmware#16579) * Clean up HAL ADC, old test scripts * Adjust GTM32 build flags (MarlinFirmware#16582) * Shared SPI sanity check (MarlinFirmware#16581) * More CI test updates * Update FYSETC S6 pins (MarlinFirmware#16559) * PINDA v2 temperature sensor / compensation (MarlinFirmware#16293) * [cron] Bump distribution date (2020-01-18) * Allow RRW Keypad with any LCD * [cron] Bump distribution date (2020-01-19) * [cron] Bump distribution date (2020-01-20) * Fix M112 with Emergency Parser * Simplify TMC monitor code * Updates for L64XX * Function-like macros * Use bool in pin compare * Patch for _STEP_INIT * Simplify a drivers.h macro (MarlinFirmware#16589) * SAMD51: ADC for probe temperature compensation (MarlinFirmware#16596) * Update FYSETC S6 Peripheral Pins (MarlinFirmware#16593) * Update BTT002 pins (MarlinFirmware#16591) * Reset shutdown timer on M85 (MarlinFirmware#16587) * AVR sanity check for MONITOR_DRIVER_STATUS with SW Serial (MarlinFirmware#16421) * STEVAL_3DP001V1: Easier Serial2 (for WIFI interface) (MarlinFirmware#16599) * Fix Greek language string (MarlinFirmware#16601) * Quad Z stepper support (MarlinFirmware#16277) * LPC1768: Allow I2C master channel override (MarlinFirmware#16584) * Move steps/mm out of slim menus (MarlinFirmware#16603) * Fix CHAMBER_MAXTEMP security margin (MarlinFirmware#16600) * L64xx M906 Fix status variable, formatting (MarlinFirmware#16597) * Provide methods for M420 + MBL (MarlinFirmware#16602) * [cron] Bump distribution date (2020-01-21) * Fix STM401/4xx/STM32F7xx timers, STEVAL_3DP001V1 warning (MarlinFirmware#16621) * Override for LPC1768 u8g/digipot I2C master ID (MarlinFirmware#16622) * Release UI on G26 priming timeout (MarlinFirmware#16449) * Add HMS434 V15 ATSAM board (MarlinFirmware#16620) * Tweak some config spacing * G12 defaults per tool. Event G-code for post-toolchange (MarlinFirmware#16554) * Arc segment radius scaling (MarlinFirmware#16551) * Update mfdoc, mfpub * [cron] Bump distribution date (2020-01-22) * Tweak mfpub stashing * [cron] Bump distribution date (2020-01-23) * Enable use of latest TMCStepper on MKS Robin Nano (MarlinFirmware#16652) * [cron] Bump distribution date (2020-01-24) * Convert chars only for enabled languages * Extra debugging for leveling on/off * Bring configs and drivers.h up to date * Duet Smart Effector support (MarlinFirmware#16641) * BigTreeTech GTR V1.0 / Support 8 extruders, heaters, temp sensors, fans (MarlinFirmware#16595) * [cron] Bump distribution date (2020-01-26) * Fix DELTA_CALIBRATION_MENU recursive call (MarlinFirmware#16656) * Fix MKS Base + Digipot compile error (MarlinFirmware#16636) * Add ESP3DLib idletask entry point (MarlinFirmware#16658) * Fix Serial defines for M43 on AVR (MarlinFirmware#16649) * Fix HOMING_BACKOFF_MM for DELTA (MarlinFirmware#16657) * Clean up PID language defines * More 8 extruder defines * Update Slovak language (MarlinFirmware#16646) * Fix M43 timer report on AVR (MarlinFirmware#16645) * Fix Spanish (swapped BLTouch strings) (MarlinFirmware#16637) * SKR 1.3 sensorless endstops hack (MarlinFirmware#16659) * Fix PID F menu label * [cron] Bump distribution date (2020-01-27) * Preserve CWD for write/remove file (MarlinFirmware#16667) * Rename some temperature members * Fix Trigorilla 1.4 limit switches See MarlinFirmware#16612 * Fix serial port redirection (index ≠ port num) (MarlinFirmware#16687) * G60/G61 Position Save/Restore (MarlinFirmware#16557) * Remove extraneous G60/G61 lines * Fix Manual Bed Leveling with multiple extruders (MarlinFirmware#16688) * [cron] Bump distribution date (2020-01-28) * Prevent SD access from resetting ESP32 (MarlinFirmware#16690) * [cron] Bump distribution date (2020-01-29) * Fix Toolchange (!no_move) return to status (MarlinFirmware#16699) * [cron] Bump distribution date (2020-01-30) * Cleanup of old includes, add comments * Fix HAS_FAN macro (MarlinFirmware#16717) * Fix probe temp calibration (MarlinFirmware#16718) * Support for E4d@BOX mainboard (MarlinFirmware#16716) * Fix missing string for M48 build (MarlinFirmware#16708) * Fix G60/G61 slots > 8 and compile error (MarlinFirmware#16715) * Move L64XX index_to_axis to progmem (MarlinFirmware#16697) * Refactor heater watch, job timer auto-start (MarlinFirmware#16725) * Auto assign DIAG pins for multi-endstop (MarlinFirmware#16723) * Tweak G60/G61 slots * Fix compile error in SdVolume on ESP32 (MarlinFirmware#16728) * Simultaneous use of rotary encoder and touch buttons (MarlinFirmware#16729) * Set up DIAG endstops for BTT SKR 1.4 / 1.4 Turbo (MarlinFirmware#16727) * Extend RX/TX pins for up to 8 extruders * Fix up, improve endstop pin auto-assignment Followup for MarlinFirmware#16723 * (21) PT100 for MCUs with 3.3v logic (MarlinFirmware#16731) * [cron] Bump distribution date (2020-01-31) * Add sanity-check for new Advanced Pause option Followup to MarlinFirmware#16372 * Include macros for delta ABC * Update Russian language (MarlinFirmware#16745) * Fix BTT SKR 1.4 extra endstop pins (MarlinFirmware#16738) * Option for Trigorilla 1.4 with add-on endstops board (MarlinFirmware#16737) * Consistent M112 with Emergency Parser (MarlinFirmware#16747) * Improve mfadd helper script - Use the original branch name if none is supplied - Set the remote tracking to the source - Accept User/Branch or User:Branch syntax * Clean up i2c encoder, sanitize serial * Misc cleanup, whitespace * Encapsulate probe as singleton class (MarlinFirmware#16751) * G34 automatic point assignment (MarlinFirmware#16473) * Fix Temperature::over_autostart_threshold (MarlinFirmware#16749) * Update Russian language (MarlinFirmware#16750) * Fix CURRENT_STEP_DOWN compile error * Drop obsolete SD special char handling See MarlinFirmware#14035 * Probe singleton patch Followup to MarlinFirmware#16751 * Fix RGB / Neopixel white color bug See MarlinFirmware#16752 * Suppress a compile warning * More 8-extruder fixups Co-authored-by: Scott Lahteine <[email protected]> Co-authored-by: Tanguy Pruvot <[email protected]> Co-authored-by: Jason Smith <[email protected]> Co-authored-by: Luc <[email protected]> Co-authored-by: thisiskeithb <[email protected]> Co-authored-by: FLYmaker <[email protected]> Co-authored-by: randellhodges <[email protected]> Co-authored-by: ferengi82 <[email protected]> Co-authored-by: Luu Lac <[email protected]> Co-authored-by: petrzjunior <[email protected]> Co-authored-by: InsanityAutomation <[email protected]> Co-authored-by: Giuliano Zaro <[email protected]> Co-authored-by: Dirk O. Kaar <[email protected]> Co-authored-by: Pascal de Bruijn <[email protected]> Co-authored-by: Bob Kuhn <[email protected]> Co-authored-by: Alexander Gavrilenko <[email protected]> Co-authored-by: swilkens <[email protected]> Co-authored-by: Lino Barreca <[email protected]> Co-authored-by: rado79 <[email protected]> Co-authored-by: Acenotass <[email protected]> Co-authored-by: ellensp <[email protected]> Co-authored-by: Walt Sorensen <[email protected]> Co-authored-by: yedey <[email protected]> Co-authored-by: George Fu <[email protected]> Co-authored-by: Vertabreaker <[email protected]> Co-authored-by: greppp <[email protected]> Co-authored-by: Jamie <[email protected]> Co-authored-by: Justin <[email protected]> Co-authored-by: ManuelMcLure <[email protected]> Co-authored-by: 0r31 <[email protected]> Co-authored-by: Alejandro Aguilera <[email protected]> Co-authored-by: meponderR <[email protected]> Co-authored-by: Mehdi Beyk Mohamadi <[email protected]> Co-authored-by: FlyingSamson <[email protected]> Co-authored-by: Ryan V1 <[email protected]> Co-authored-by: David Klasinc <[email protected]> Co-authored-by: gjdodd <[email protected]> Co-authored-by: Dennis <[email protected]> Co-authored-by: felixstorm <[email protected]> Co-authored-by: vivian-ng <[email protected]> Co-authored-by: tompe-proj <[email protected]> Co-authored-by: MaukCC <[email protected]> Co-authored-by: Ryan <[email protected]> Co-authored-by: Artur Petrzak <[email protected]> Co-authored-by: yangwenxiong <[email protected]> Co-authored-by: Roman Moravčík <[email protected]> Co-authored-by: Robby Candra <[email protected]> Co-authored-by: Hans007a <[email protected]> Co-authored-by: Neskik <[email protected]> Co-authored-by: Mauro <[email protected]> Co-authored-by: Radek Pietruszewski <[email protected]> Co-authored-by: chgi <[email protected]> Co-authored-by: Robert Stein <[email protected]> Co-authored-by: rebel1 <[email protected]>
This is currently a draft. It works on my board. I welcome contributions to include other variations of the STM32 platform, if it is something the community would like to pursue.
My C/C++ skills are beginner level so I'm sure things can "better".
Description
The STM32 library, specifically framework-adruinoststm32 as used by the SKR PRO 1.1 has a simple flash eeprom implementation that writes a buffer in the same location on all the STM32 boards.
This PR is the basis (more work will be needed if we want to try to cover everything) of adding LPC style wear leveling to the flash operations.
Currently, only
STM32F407xx
andSTM32F446xx
have the option of enabling this new feature. To enabled:#define EEPROM_SETTINGS
#define FLASH_EEPROM_EMULATION
#define FLASH_EEPROM_LEVELING
If you do not add
#define FLASH_EEPROM_LEVELING
then it will just use the platforms version of eeprom saving. It supports more versions, but again, only writes to the same flash locations.Why isn't everything supported?
The STM32 platform is a circus. Some chips have a concept of
sectors
and somepages
. Really, there isn't that much difference between the 2. Asector
and apage
are still the smallest unit you can erase. It is just that apage
is generally around 2 or 4kB in size, whereas asector
is between 16kB and 128kB. The ones at the end of the flash that we can use are always (?) 128kB.To complicate matters further, some chips have multiple
banks
. From what I can gather, there are different ways to use the banks.In order to support everything, we'd have to look more into
stm32_eeprom.c
(where I took inspiration) and add in all the different#define
they have.The hard part, is, for those that use small
pages
of 2kB, we'd have to keep track of multiple pages. If we want to keep the 4kB eeprom, then we'd have to manage 2 pages perslot
.This simple implementation defines a maximum number of
slots
by dividing the sector by the eeprom size. The out of the box defines means we have 32 slots.What's next?
The LPC code included disabling interrupts during operations. I am unsure if the STM32 platform needs that or not. I don't really see anything in the platform eeprom version, nor on the internet about it.
More boards. I know there is talk of merging the other STM32 HALs. At a minimum we might want to add in support for the F103 board (a
pages
board). This would, I think, cover over 80% of the current STM32 boards.Benefits
Flash doesn't wear out as fast.
Credit
Most of the code is a mashup of the HAL_STM32 and HAL_LPC1768 and the framework-arduinoststm32/cores/arduino/stm32/stm32_eeprom.* (and other files).