This fix creates a flag that prevents fb_alloc_free_till_mark() from doing anything unless there was a previous fb_alloc_mark(). Once fb_alloc_free_till_mark() is called it will no longer do anything until there's another fb_alloc_mark(). This means that if an exception is triggered while in code that previously did fb_alloc_mark() the stack will be cleaned up. If the fb_alloc_mark() method is not called then the stack will not be cleaned up and that memory fb_alloc()'ed will remain until a soft reset. All OpenMV Cam library code is designed to fb_alloc_mark() before using the fb stack and then fb_alloc_free_till_mark() when complete. However, in the case of py_sensor_alloc_extra_fb() it doesn't mark first such that the RAM it allocates stays across exceptions and is only free'd via py_sensor_dealloc_extra_fb() or via a soft reset. ... Summary of changes: fb_alloc.c -> Added a semaphore lock to prevent fb_alloc_free_till_mark() from doing anything unless fb_alloc_mark() was called first. py_sensor.c -> Removed calling fb_alloc_mark() and fb_alloc_free_till_mark() and re-arranged code calls to prevent a trival leak sitatuion on heap exhaustion. py_image.c, py_fir.c, py_lcd.c py_tv.c -> Added fb_alloc_mark() and fb_alloc_free_till_mark() to methods originally coded without using it. ... Note - I coded the mark semaphore lock in such a way things work even if fb_alloc_mark() and fb_alloc_free_till_mark() calls are nested. This allows the find_blobs() call-back methods to call py_image.c methods still and also allows us to add more call-backs in the future without worry if we need to. ... Finally, if you have an exception in an interrupt handler all this above breaks terribly. Given MP already breaks if you try to allocate memory in an exception this is a "won't fix problem". Don't call code that can have exceptions or needs memory in an interrupt handler. |
||
|---|---|---|
| .github | ||
| firmware | ||
| ml | ||
| scripts | ||
| src | ||
| tools | ||
| udev | ||
| .gitignore | ||
| .gitmodules | ||
| .travis.yml | ||
| CHANGELOG.md | ||
| LICENSE | ||
| README.md | ||
OpenMV (Open-Source Machine Vision)
The OpenMV project aims at making machine vision more accessible to beginners by developing a user-friendly, open-source, low-cost machine vision platform.
OpenMV cameras are programmable in Python3 and come with an extensive set of image processing functions such as face detection, keypoints descriptors, color tracking, QR and Bar codes decoding, AprilTags, GIF and MJPEG recording and more. Additionally, OpenMV includes a cross-platform IDE (based on Qt Creator) designed specifically to support programmable cameras. The IDE allows viewing the camera's frame buffer, accessing sensor controls, uploading scripts to the camera via serial over USB (or WiFi/BLE if available) and includes a set of image processing tools to generate tags, thresholds, keypoints etc...
The first generation of OpenMV cameras is based on STM32F ARM Cortex-M Digital Signal Controllers (DSCs) and Omnivision sensors. The board has built-in RGB and IR LEDs, USB FS for programming and video streaming, uSD socket and I/O headers breaking out PWM, UARTs, SPI and I2C. Additionally, OpenMV supports extension modules (shields) using the I/O headers such as WiFi, BLE, Thermal (FIR) and LCD shields.
The OpenMV project was successfully funded via Kickstarter back in 2015 and has come a long way since then. For more information, please visit https://openmv.io