Project IceStorm - Lattice iCE40 FPGAs Bitstream Documentation (Reverse Engineered)
Go to file
The6P4C 578037dedf icepack: Fix Windows-only stack overflow in CRAM pbm generation (fixes #241)
On Windows, attempting to generate a netpbm image of the CRAM with
`icepack -b` causes the tool to crash after writing only the netpbm
header due to a stack overflow. The bug did not appear on Linux.

This was traced to a large stack-allocated variable length array
(`tile_type`) inside `FpgaConfig::write_cram_pbm`. For an 8k ice40 with
4 banks, `cram_width = 872` and `cram_height = 272` the `tile_type`
array ends up at `4 * 872 * 272 * sizeof(uint32_t) =` 3794944 bytes, or
about 3.6 MiB.

The fix replaces the large stack VLA with an array of 4 (bank) 2D C++
vectors, moving the large amount of data to the heap. Even though the
fix is not in a Windows-specific code path (and hence applies to all
platforms), I think it's wise to eliminate such a large stack allocation
entirely.

The fix has been tested working on both Windows and an Ubuntu WSL
install.
2019-12-08 23:52:05 +10:00
docs docs: Add new Eigen3 dependency 2019-04-02 14:53:52 +01:00
examples Improve icestick rs232demo example 2019-02-14 02:45:25 +01:00
icebox Only dump memory initialization in icebox_vlog if present in ASC file, fixes #228 2019-08-08 17:07:52 +02:00
icebram Remove rogue space 2018-06-02 19:10:51 -07:00
icecompr Squelch trailing whitespace 2017-08-01 14:43:15 +02:00
icefuzz add RGB_DRV/LED_DRV_CUR for u4k 2019-06-10 13:06:11 +02:00
icemulti Mount NODEFS if using emscripten and nodejs 2018-03-31 14:10:36 -07:00
icepack icepack: Fix Windows-only stack overflow in CRAM pbm generation (fixes #241) 2019-12-08 23:52:05 +10:00
icepll icepll: Add support for writing output data to stdout 2019-05-26 17:01:41 +02:00
iceprog Merge pull request #230 from smunaut/fix_flash_reset 2019-08-15 13:31:53 +02:00
icetime icetime: Add generated timings-*.cc files to .gitignore and make clean 2019-06-07 22:55:48 +02:00
.gitignore Added/improved support for mxe-based win32 cross builds 2016-02-14 13:47:27 +01:00
COPYING Creating COPYING file. 2017-12-08 16:12:30 -08:00
CodeOfConduct Added CodeOfConduct 2016-02-01 18:54:09 +01:00
Makefile Make iceprog optional. 2019-08-31 14:03:14 +00:00
README Added license to README 2015-08-19 09:10:50 +02:00
config.mk Make iceprog optional. 2019-08-31 14:03:14 +00:00

README

Project IceStorm aims at documenting the bitstream format of Lattice iCE40
FPGAs and providing simple tools for analyzing and creating bitstream files.

See http://www.clifford.at/icestorm/ for more information.

Most of Project IceStorm is licensed under the ISC license:

#  Permission to use, copy, modify, and/or distribute this software for any
#  purpose with or without fee is hereby granted, provided that the above
#  copyright notice and this permission notice appear in all copies.
#
#  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
#  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
#  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
#  ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
#  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
#  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
#  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.