[Cryptech-Commits] [sw/stm32] branch master updated: Revert a clean up 'fix' which actually broke FPGA upload.

git at cryptech.is git at cryptech.is
Thu Dec 14 20:38:05 UTC 2017


This is an automated email from the git hooks/post-receive script.

paul at psgd.org pushed a commit to branch master
in repository sw/stm32.

The following commit(s) were added to refs/heads/master by this push:
     new b35b87e  Revert a clean up 'fix' which actually broke FPGA upload.
b35b87e is described below

commit b35b87ea14016760786319a23b87792f1e1041de
Author: Paul Selkirk <paul at psgd.org>
AuthorDate: Thu Dec 14 15:37:14 2017 -0500

    Revert a clean up 'fix' which actually broke FPGA upload.
---
 projects/cli-test/mgmt-fpga.c | 11 ++++++++---
 projects/hsm/mgmt-fpga.c      |  9 +++++++--
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/projects/cli-test/mgmt-fpga.c b/projects/cli-test/mgmt-fpga.c
index a307436..b913316 100644
--- a/projects/cli-test/mgmt-fpga.c
+++ b/projects/cli-test/mgmt-fpga.c
@@ -3,7 +3,7 @@
  * -----------
  * CLI code to manage the FPGA configuration etc.
  *
- * Copyright (c) 2016, NORDUnet A/S All rights reserved.
+ * Copyright (c) 2016-2017, NORDUnet A/S All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -56,8 +56,13 @@ static HAL_StatusTypeDef _flash_write_callback(uint8_t *buf, size_t len)
 	if ((res = fpgacfg_erase_sector(dfu_offset / FPGACFG_SECTOR_SIZE)) != HAL_OK)
 	    return res;
 
-    res = fpgacfg_write_data(dfu_offset, buf, len);
-    dfu_offset += len;
+    /* fpgacfg_write_data (a thin wrapper around n25q128_write_data)
+     * requires the offset and length to be page-aligned. The last chunk
+     * will be short, so we pad it out to the full chunk size.
+     */
+    len = len;
+    res = fpgacfg_write_data(dfu_offset, buf, BITSTREAM_UPLOAD_CHUNK_SIZE);
+    dfu_offset += BITSTREAM_UPLOAD_CHUNK_SIZE;
     return res;
 }
 
diff --git a/projects/hsm/mgmt-fpga.c b/projects/hsm/mgmt-fpga.c
index b535b1d..af7ba11 100644
--- a/projects/hsm/mgmt-fpga.c
+++ b/projects/hsm/mgmt-fpga.c
@@ -64,8 +64,13 @@ static HAL_StatusTypeDef _flash_write_callback(uint8_t *buf, size_t len)
 	if ((res = fpgacfg_erase_sector(dfu_offset / FPGACFG_SECTOR_SIZE)) != CMSIS_HAL_OK)
 	    return res;
 
-    res = fpgacfg_write_data(dfu_offset, buf, len);
-    dfu_offset += len;
+    /* fpgacfg_write_data (a thin wrapper around n25q128_write_data)
+     * requires the offset and length to be page-aligned. The last chunk
+     * will be short, so we pad it out to the full chunk size.
+     */
+    len = len;
+    res = fpgacfg_write_data(dfu_offset, buf, BITSTREAM_UPLOAD_CHUNK_SIZE);
+    dfu_offset += BITSTREAM_UPLOAD_CHUNK_SIZE;
     return res;
 }
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Commits mailing list