2011/9/27 Clément Burin des Roziers <[email protected]>:
> Hello Øyvind,
> I've prepared a new patch, fixing the memory issues.
Some more comments. I was ready to commit, but got warnings...
1. Warning:
cc1: warnings being treated as errors
stm32lx.c: In function ‘stm32lx_write_half_pages’:
stm32lx.c:286: error: format ‘%lu’ expects type ‘long unsigned int’,
but argument 6 has type ‘unsigned int’
+ LOG_DEBUG("writing flash code (%lu bytes)",
sizeof(stm32lx_flash_write_code));
=> switch to the PRI macros, such as:
LOG_ERROR("chip address %08" PRIx32 " not NAND-enabled?", info->data);
return ERROR_NAND_OPERATION_FAILED;
2. Use goto instead of this construct, or better, split out in a
separate fn so it's easier
to handle cleanup of resources.
+static int stm32lx_write_half_pages(struct flash_bank *bank, uint8_t *buffer,
+ uint32_t offset, uint32_t count)
+{
...
+ if (retval == ERROR_OK)
+ {
+ reg32 |= FLASH_PECR__PROG;
+ retval = target_write_u32(target, FLASH_PECR, reg32);
+ }
+
+ // Loop while there are bytes to write
+ while ((retval == ERROR_OK) && (count > 0))
+ {
--
Øyvind Harboe - Can Zylin Consulting help on your project?
US toll free 1-866-980-3434
http://www.zylin.com/
_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development