Browse Source

cc2538 algo: don't bother erasing already-empty pages

Change-Id: Ibb14206b755e8c28a9618aaeb5eee455f4f3b805
jim
Jim Paris 2 years ago
committed by Jim Paris <jim@jim.sh>
parent
commit
0f266a301c
2 changed files with 49 additions and 37 deletions
  1. +37
    -37
      contrib/loaders/flash/cc2538/cc2538_algo.inc
  2. +12
    -0
      contrib/loaders/flash/cc2538/flash.c

+ 37
- 37
contrib/loaders/flash/cc2538/cc2538_algo.inc View File

@@ -1,19 +1,19 @@
/* Autogenerated with ../../../../src/helper/bin2char.sh */
0x72,0xb6,0x4f,0xf0,0x00,0x00,0x80,0xf3,0x14,0x88,0xbf,0xf3,0x6f,0x8f,0x09,0x48,
0x85,0x46,0xbf,0xf3,0x6f,0x8f,0x4f,0xf0,0x00,0x00,0x07,0x49,0x07,0x4a,0x91,0x42,
0xb8,0xbf,0x41,0xf8,0x04,0x0b,0xfa,0xdb,0x00,0xf0,0xf0,0xf9,0x00,0xf0,0x2c,0xf9,
0xfe,0xe7,0x00,0x00,0xd8,0x1b,0x00,0x20,0xec,0x0a,0x00,0x20,0x10,0x0c,0x00,0x20,
0xb8,0xbf,0x41,0xf8,0x04,0x0b,0xfa,0xdb,0x00,0xf0,0xf8,0xf9,0x00,0xf0,0x2c,0xf9,
0xfe,0xe7,0x00,0x00,0xd8,0x1b,0x00,0x20,0xfc,0x0a,0x00,0x20,0x20,0x0c,0x00,0x20,
0x06,0x48,0x07,0x4b,0x10,0xb5,0x83,0x42,0x04,0xd0,0x06,0x4b,0x00,0x2b,0x01,0xd0,
0x00,0xf0,0x4e,0xf8,0x10,0xbc,0x01,0xbc,0x00,0x47,0xc0,0x46,0xe8,0x0a,0x00,0x20,
0xe8,0x0a,0x00,0x20,0x00,0x00,0x00,0x00,0x08,0x48,0x09,0x49,0x09,0x1a,0x89,0x10,
0x00,0xf0,0x4e,0xf8,0x10,0xbc,0x01,0xbc,0x00,0x47,0xc0,0x46,0xf8,0x0a,0x00,0x20,
0xf8,0x0a,0x00,0x20,0x00,0x00,0x00,0x00,0x08,0x48,0x09,0x49,0x09,0x1a,0x89,0x10,
0xcb,0x0f,0x59,0x18,0x10,0xb5,0x49,0x10,0x04,0xd0,0x06,0x4b,0x00,0x2b,0x01,0xd0,
0x00,0xf0,0x36,0xf8,0x10,0xbc,0x01,0xbc,0x00,0x47,0xc0,0x46,0xe8,0x0a,0x00,0x20,
0xe8,0x0a,0x00,0x20,0x00,0x00,0x00,0x00,0x10,0xb5,0x08,0x4c,0x23,0x78,0x00,0x2b,
0x00,0xf0,0x36,0xf8,0x10,0xbc,0x01,0xbc,0x00,0x47,0xc0,0x46,0xf8,0x0a,0x00,0x20,
0xf8,0x0a,0x00,0x20,0x00,0x00,0x00,0x00,0x10,0xb5,0x08,0x4c,0x23,0x78,0x00,0x2b,
0x09,0xd1,0xff,0xf7,0xcd,0xff,0x06,0x4b,0x00,0x2b,0x02,0xd0,0x05,0x48,0xaf,0xf3,
0x00,0x80,0x01,0x23,0x23,0x70,0x10,0xbc,0x01,0xbc,0x00,0x47,0xec,0x0a,0x00,0x20,
0x00,0x00,0x00,0x00,0x94,0x06,0x00,0x20,0x06,0x4b,0x10,0xb5,0x00,0x2b,0x03,0xd0,
0x00,0x80,0x01,0x23,0x23,0x70,0x10,0xbc,0x01,0xbc,0x00,0x47,0xfc,0x0a,0x00,0x20,
0x00,0x00,0x00,0x00,0xa4,0x06,0x00,0x20,0x06,0x4b,0x10,0xb5,0x00,0x2b,0x03,0xd0,
0x05,0x49,0x06,0x48,0xaf,0xf3,0x00,0x80,0xff,0xf7,0xc6,0xff,0x10,0xbc,0x01,0xbc,
0x00,0x47,0xc0,0x46,0x00,0x00,0x00,0x00,0xf0,0x0a,0x00,0x20,0x94,0x06,0x00,0x20,
0x00,0x47,0xc0,0x46,0x00,0x00,0x00,0x00,0x00,0x0b,0x00,0x20,0xa4,0x06,0x00,0x20,
0x18,0x47,0xc0,0x46,0xd4,0x30,0x9f,0xe5,0x00,0x00,0x53,0xe3,0xc8,0x30,0x9f,0x05,
0x03,0xd0,0xa0,0xe1,0x00,0x20,0x0f,0xe1,0x0f,0x00,0x12,0xe3,0x15,0x00,0x00,0x0a,
0xd1,0xf0,0x21,0xe3,0x03,0xd0,0xa0,0xe1,0x01,0xaa,0x4d,0xe2,0x0a,0x30,0xa0,0xe1,
@@ -23,23 +23,23 @@
0xff,0x30,0xc3,0xe3,0xff,0x3c,0xc3,0xe3,0x04,0x30,0x03,0xe5,0x00,0x20,0x53,0xe9,
0xc0,0x20,0x82,0xe3,0x02,0xf0,0x21,0xe1,0x01,0xa8,0x43,0xe2,0x00,0x10,0xb0,0xe3,
0x01,0xb0,0xa0,0xe1,0x01,0x70,0xa0,0xe1,0x5c,0x00,0x9f,0xe5,0x5c,0x20,0x9f,0xe5,
0x00,0x20,0x52,0xe0,0x01,0x30,0x8f,0xe2,0x13,0xff,0x2f,0xe1,0x00,0xf0,0x68,0xf9,
0x00,0x20,0x52,0xe0,0x01,0x30,0x8f,0xe2,0x13,0xff,0x2f,0xe1,0x00,0xf0,0x70,0xf9,
0x10,0x4b,0x00,0x2b,0x01,0xd0,0xfe,0x46,0x9f,0x46,0x0f,0x4b,0x00,0x2b,0x01,0xd0,
0xfe,0x46,0x9f,0x46,0x00,0x20,0x00,0x21,0x04,0x00,0x0d,0x00,0x0d,0x48,0x00,0xf0,
0xf1,0xf8,0x00,0xf0,0x2b,0xf9,0x20,0x00,0x29,0x00,0x00,0xf0,0x65,0xf8,0x00,0xf0,
0xf3,0xf8,0x7b,0x46,0x18,0x47,0x00,0x00,0x11,0x00,0x00,0xef,0x00,0x00,0x08,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xec,0x0a,0x00,0x20,
0x10,0x0c,0x00,0x20,0xd1,0x03,0x00,0x20,0x38,0xb5,0x0d,0x46,0x14,0x46,0x00,0x21,
0x28,0x22,0x00,0xf0,0x35,0xf9,0x4f,0xf4,0x80,0x72,0x05,0x61,0x44,0x62,0x00,0x21,
0x02,0x48,0x00,0xf0,0x2d,0xf9,0x00,0x20,0x38,0xbd,0x00,0xbf,0x08,0x0b,0x00,0x20,
0x10,0xb5,0x00,0xf0,0x9f,0xf8,0x04,0x46,0x38,0xb9,0x4f,0xf4,0x80,0x72,0x01,0x21,
0x03,0x48,0x00,0xf0,0x1d,0xf9,0x20,0x46,0x10,0xbd,0x40,0xf2,0x01,0x14,0xfa,0xe7,
0x08,0x0b,0x00,0x20,0xf8,0xb5,0x01,0x27,0xa1,0xf5,0x00,0x11,0x01,0x39,0xa0,0xf5,
0xf9,0xf8,0x00,0xf0,0x33,0xf9,0x20,0x00,0x29,0x00,0x00,0xf0,0x65,0xf8,0x00,0xf0,
0xfb,0xf8,0x7b,0x46,0x18,0x47,0x00,0x00,0x11,0x00,0x00,0xef,0x00,0x00,0x08,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0x0a,0x00,0x20,
0x20,0x0c,0x00,0x20,0xe1,0x03,0x00,0x20,0x38,0xb5,0x0d,0x46,0x14,0x46,0x00,0x21,
0x28,0x22,0x00,0xf0,0x3d,0xf9,0x4f,0xf4,0x80,0x72,0x05,0x61,0x44,0x62,0x00,0x21,
0x02,0x48,0x00,0xf0,0x35,0xf9,0x00,0x20,0x38,0xbd,0x00,0xbf,0x18,0x0b,0x00,0x20,
0x10,0xb5,0x00,0xf0,0xa7,0xf8,0x04,0x46,0x38,0xb9,0x4f,0xf4,0x80,0x72,0x01,0x21,
0x03,0x48,0x00,0xf0,0x25,0xf9,0x20,0x46,0x10,0xbd,0x40,0xf2,0x01,0x14,0xfa,0xe7,
0x18,0x0b,0x00,0x20,0xf8,0xb5,0x01,0x27,0xa1,0xf5,0x00,0x11,0x01,0x39,0xa0,0xf5,
0x00,0x14,0x01,0x44,0x0c,0x4e,0xe4,0x0a,0xcd,0x0a,0xac,0x42,0x01,0xd9,0x00,0x20,
0x0e,0xe0,0xa3,0x5d,0x73,0xb9,0x04,0xf5,0x80,0x60,0xc0,0x02,0x00,0xf0,0x60,0xf8,
0x38,0xb1,0x00,0x04,0x00,0xf4,0x7f,0x00,0x40,0xea,0x04,0x60,0x40,0xf4,0x81,0x70,
0xf8,0xbd,0xa7,0x55,0x01,0x34,0xe8,0xe7,0x08,0x0b,0x00,0x20,0x08,0xb5,0x00,0xf0,
0x7f,0xf8,0x00,0x20,0x08,0xbd,0x00,0x00,0xf8,0xb5,0x20,0x4a,0x20,0x49,0x21,0x48,
0xf8,0xbd,0xa7,0x55,0x01,0x34,0xe8,0xe7,0x18,0x0b,0x00,0x20,0x08,0xb5,0x00,0xf0,
0x87,0xf8,0x00,0x20,0x08,0xbd,0x00,0x00,0xf8,0xb5,0x20,0x4a,0x20,0x49,0x21,0x48,
0x20,0x4e,0xff,0xf7,0xa9,0xff,0x00,0x23,0x14,0x25,0x34,0x46,0x1e,0x4f,0x3b,0x60,
0x3b,0x68,0x05,0xfb,0x03,0x63,0x03,0xf1,0x08,0x02,0x51,0x68,0x00,0x29,0xfc,0xd0,
0x12,0x68,0x02,0x2a,0x0d,0xd0,0x03,0x2a,0x11,0xd0,0x01,0x2a,0x14,0xd1,0xff,0xf7,
@@ -48,18 +48,19 @@
0x59,0x68,0xff,0xf7,0xa7,0xff,0xec,0xe7,0x40,0xf2,0x05,0x10,0xeb,0xe7,0x05,0xfb,
0x02,0x43,0x19,0x7b,0x18,0x73,0x59,0x7b,0x58,0x73,0x99,0x7b,0x82,0xf0,0x01,0x02,
0x98,0x73,0xd9,0x7b,0x3a,0x60,0xd8,0x73,0xca,0xe7,0x00,0xbf,0x00,0x24,0x00,0x20,
0x00,0x1c,0x00,0x20,0xd8,0x1b,0x00,0x20,0x08,0x0c,0x00,0x20,0xfe,0xe7,0x00,0x00,
0x08,0xb5,0x0b,0x4b,0x4f,0xf4,0x00,0x61,0x1b,0x68,0xdb,0x68,0x98,0x47,0x42,0x1c,
0x07,0xd0,0x83,0x1c,0x08,0xd0,0x00,0x28,0x40,0xf2,0x03,0x10,0x08,0xbf,0x00,0x20,
0x08,0xbd,0x40,0xf2,0x01,0x10,0xfb,0xe7,0x4f,0xf4,0x81,0x70,0xf8,0xe7,0x00,0xbf,
0xa8,0x06,0x00,0x20,0x38,0xb5,0x00,0x24,0x08,0x4d,0x2b,0x68,0x5b,0x68,0x98,0x47,
0x00,0x1c,0x00,0x20,0xd8,0x1b,0x00,0x20,0x18,0x0c,0x00,0x20,0xfe,0xe7,0x00,0x00,
0x08,0xb5,0x02,0x68,0x4f,0xf4,0x00,0x73,0x01,0x32,0x0d,0xd1,0x01,0x3b,0xfd,0xd1,
0x00,0x20,0x08,0xbd,0x82,0x1c,0x04,0xd0,0x00,0x28,0xf9,0xd0,0x40,0xf2,0x03,0x10,
0xf7,0xe7,0x4f,0xf4,0x81,0x70,0xf4,0xe7,0x05,0x4b,0x4f,0xf4,0x00,0x61,0x1b,0x68,
0xdb,0x68,0x98,0x47,0x43,0x1c,0xed,0xd1,0x40,0xf2,0x01,0x10,0xe9,0xe7,0x00,0xbf,
0xb8,0x06,0x00,0x20,0x38,0xb5,0x00,0x24,0x08,0x4d,0x2b,0x68,0x5b,0x68,0x98,0x47,
0xb4,0xeb,0xd0,0x2f,0x01,0xd3,0x00,0x20,0x38,0xbd,0x04,0xf5,0x80,0x60,0xc0,0x02,
0xff,0xf7,0xd6,0xff,0x00,0x28,0xf7,0xd1,0x01,0x34,0xee,0xe7,0xa8,0x06,0x00,0x20,
0xff,0xf7,0xce,0xff,0x00,0x28,0xf7,0xd1,0x01,0x34,0xee,0xe7,0xb8,0x06,0x00,0x20,
0x02,0x4b,0x03,0x4a,0x1a,0x60,0x01,0x32,0x5a,0x61,0xfe,0xe7,0xe4,0x1b,0x00,0x20,
0xb1,0xbb,0xaa,0xaa,0x10,0xb5,0x01,0x00,0x00,0x23,0x00,0x22,0x00,0x20,0x00,0xf0,
0xb1,0xf8,0x10,0xbc,0x02,0xbc,0x08,0x47,0x10,0xb5,0x00,0x21,0x04,0x00,0x00,0xf0,
0xef,0xf8,0x05,0x4b,0x18,0x68,0xc3,0x6b,0x00,0x2b,0x01,0xd0,0x00,0xf0,0x06,0xf8,
0x20,0x00,0xff,0xf7,0xab,0xff,0xc0,0x46,0xa0,0x06,0x00,0x20,0x18,0x47,0xc0,0x46,
0x20,0x00,0xff,0xf7,0xa3,0xff,0xc0,0x46,0xb0,0x06,0x00,0x20,0x18,0x47,0xc0,0x46,
0x70,0xb5,0x0a,0x4b,0x0a,0x4c,0xe4,0x1a,0xa4,0x10,0x0a,0xd0,0x09,0x4a,0xa5,0x18,
0xad,0x00,0xed,0x18,0x2b,0x68,0x01,0x3c,0x00,0xf0,0x0e,0xf8,0x04,0x3d,0x00,0x2c,
0xf8,0xd1,0x00,0xf0,0x49,0xf9,0x70,0xbc,0x01,0xbc,0x00,0x47,0x00,0x00,0x00,0x00,
@@ -87,7 +88,7 @@
0xac,0x44,0x67,0x46,0xa2,0x40,0x3f,0x68,0x90,0x46,0x17,0x43,0x62,0x46,0x17,0x60,
0x84,0x27,0x7f,0x00,0xf3,0x51,0x02,0x28,0xde,0xd1,0x2b,0x00,0x40,0x46,0x8d,0x33,
0xff,0x33,0x1a,0x68,0x10,0x43,0x18,0x60,0xd6,0xe7,0x01,0x9d,0x01,0x9e,0x4d,0x35,
0xff,0x35,0x35,0x51,0xcb,0xe7,0x01,0x20,0x40,0x42,0xd3,0xe7,0xa0,0x06,0x00,0x20,
0xff,0x35,0x35,0x51,0xcb,0xe7,0x01,0x20,0x40,0x42,0xd3,0xe7,0xb0,0x06,0x00,0x20,
0xf0,0xb5,0x4e,0x46,0xde,0x46,0x57,0x46,0x45,0x46,0xe0,0xb5,0x2e,0x4b,0x1b,0x68,
0x83,0xb0,0x1a,0x00,0x00,0x93,0xa4,0x23,0x5b,0x00,0xd6,0x58,0x01,0x22,0x01,0x90,
0x0f,0x00,0x93,0x46,0x99,0x46,0x00,0x2e,0x31,0xd0,0x74,0x68,0x65,0x1e,0x2e,0xd4,
@@ -100,14 +101,14 @@
0x3c,0xbc,0x90,0x46,0x99,0x46,0xa2,0x46,0xab,0x46,0xf0,0xbc,0x01,0xbc,0x00,0x47,
0x75,0x60,0xde,0xe7,0x30,0x00,0x21,0x00,0x8d,0x30,0xff,0x30,0x00,0x68,0x80,0x31,
0x09,0x68,0x18,0x42,0x03,0xd1,0x01,0x98,0x00,0xf0,0x08,0xf8,0xdd,0xe7,0x08,0x00,
0x00,0xf0,0x04,0xf8,0xd9,0xe7,0xc0,0x46,0xa0,0x06,0x00,0x20,0x10,0x47,0xc0,0x46,
0x00,0xf0,0x04,0xf8,0xd9,0xe7,0xc0,0x46,0xb0,0x06,0x00,0x20,0x10,0x47,0xc0,0x46,
0x04,0x4b,0x10,0xb5,0x00,0x2b,0x02,0xd0,0x03,0x48,0xff,0xf7,0x93,0xfe,0x10,0xbc,
0x01,0xbc,0x00,0x47,0x00,0x00,0x00,0x00,0xd1,0x03,0x00,0x20,0xf8,0xb5,0xc0,0x46,
0x01,0xbc,0x00,0x47,0x00,0x00,0x00,0x00,0xe1,0x03,0x00,0x20,0xf8,0xb5,0xc0,0x46,
0xf8,0xbc,0x08,0xbc,0x9e,0x46,0x70,0x47,0xf8,0xb5,0xc0,0x46,0xf8,0xbc,0x08,0xbc,
0x9e,0x46,0x70,0x47,0x00,0x00,0x00,0x00,0x5c,0xfa,0xff,0x7f,0x01,0x00,0x00,0x00,
0xb8,0x06,0x00,0x20,0x00,0x00,0x00,0x00,0x48,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xb8,0x06,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa4,0x09,0x00,0x20,
0x0c,0x0a,0x00,0x20,0x74,0x0a,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x9e,0x46,0x70,0x47,0x00,0x00,0x00,0x00,0x4c,0xfa,0xff,0x7f,0x01,0x00,0x00,0x00,
0xc8,0x06,0x00,0x20,0x00,0x00,0x00,0x00,0x48,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xc8,0x06,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xb4,0x09,0x00,0x20,
0x1c,0x0a,0x00,0x20,0x84,0x0a,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
@@ -173,8 +174,7 @@
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xc9,0x00,0x00,0x20,0x99,0x00,0x00,0x20,0x61,0x06,0x00,0x20,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xc9,0x00,0x00,0x20,0x99,0x00,0x00,0x20,0x71,0x06,0x00,0x20,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,


+ 12
- 0
contrib/loaders/flash/cc2538/flash.c View File

@@ -52,6 +52,18 @@ struct rom_api {
extern uint32_t flash_sector_erase(uint32_t sector_address)
{
long ret;
bool already_erased = true;
int i;

for (i = 0; i < FLASH_ERASE_SIZE / 4; i++) {
if ((*(uint32_t *)sector_address) != 0xffffffff) {
already_erased = false;
break;
}
}
if (already_erased)
return 0;

ret = ROM->PageErase(sector_address, FLASH_ERASE_SIZE);
if (ret == -1)
return 0x101;


Loading…
Cancel
Save