From d8d5f97a0aad22f914d1235d755bbfa085e55ba9 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 9 Nov 2011 08:09:56 +1100 Subject: [PATCH] desktop: use less stack this avoids a problem on cygwin on windows --- libraries/Desktop/support/DataFlash.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libraries/Desktop/support/DataFlash.cpp b/libraries/Desktop/support/DataFlash.cpp index e80171d17b..0e5354a980 100644 --- a/libraries/Desktop/support/DataFlash.cpp +++ b/libraries/Desktop/support/DataFlash.cpp @@ -29,10 +29,12 @@ void DataFlash_Class::Init(void) if (flash_fd == 0) { flash_fd = open("dataflash.bin", O_RDWR, 0777); if (flash_fd == -1) { - uint8_t fill[DF_PAGE_SIZE*DF_NUM_PAGES]; + uint8_t *fill; + fill = malloc(DF_PAGE_SIZE*DF_NUM_PAGES); flash_fd = open("dataflash.bin", O_RDWR | O_CREAT, 0777); - memset(fill, 0xFF, sizeof(fill)); - write(flash_fd, fill, sizeof(fill)); + memset(fill, 0xFF, DF_PAGE_SIZE*DF_NUM_PAGES); + write(flash_fd, fill, DF_PAGE_SIZE*DF_NUM_PAGES); + free(fill); } } df_PageSize = DF_PAGE_SIZE;