You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

66 lines
2.8 KiB

  1. /***************************************************************************
  2. * Copyright (C) 2020 Loci Controls Inc *
  3. * Copyright (C) 2017 by Texas Instruments, Inc. *
  4. * *
  5. * This program is free software; you can redistribute it and/or modify *
  6. * it under the terms of the GNU General Public License as published by *
  7. * the Free Software Foundation; either version 2 of the License, or *
  8. * (at your option) any later version. *
  9. * *
  10. * This program is distributed in the hope that it will be useful, *
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  13. * GNU General Public License for more details. *
  14. * *
  15. * You should have received a copy of the GNU General Public License *
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>. *
  17. ***************************************************************************/
  18. #ifndef OPENOCD_FLASH_NOR_CC2538_H
  19. #define OPENOCD_FLASH_NOR_CC2538_H
  20. #define CC2538_FLASH_BASE_ADDR 0x00200000
  21. #define CC2538_FLASH_MAX_SIZE 0x00080000
  22. #define CC2538_ALGO_BASE_ADDRESS 0x20000000
  23. #define CC2538_FLASH_CTRL_DIECFG0 0x400D3014
  24. /* Flash algorithm parameters */
  25. #define CC2538_MAX_SECTORS 256
  26. #define CC2538_SECTOR_LENGTH 0x800
  27. #define CC2538_ALGO_BUFFER_0 0x20001c00
  28. #define CC2538_ALGO_BUFFER_1 0x20002c00
  29. #define CC2538_ALGO_PARAMS_0 0x20001bd8
  30. #define CC2538_ALGO_PARAMS_1 0x20001bec
  31. #define CC2538_WORKING_SIZE (CC2538_ALGO_BUFFER_1 + CC2538_SECTOR_LENGTH - \
  32. CC2538_ALGO_BASE_ADDRESS)
  33. /* Flash helper algorithm buffer flags */
  34. #define CC2538_BUFFER_EMPTY 0x00000000
  35. #define CC2538_BUFFER_FULL 0xffffffff
  36. /* Flash helper algorithm commands */
  37. #define CC2538_CMD_NO_ACTION 0
  38. #define CC2538_CMD_ERASE_ALL 1
  39. #define CC2538_CMD_PROGRAM 2
  40. #define CC2538_CMD_ERASE_SECTORS 3
  41. /* Flash helper algorithm parameter block struct */
  42. #define CC2538_STATUS_OFFSET 0x0c
  43. struct cc2538_algo_params {
  44. uint8_t address[4];
  45. uint8_t length[4];
  46. uint8_t command[4];
  47. uint8_t status[4];
  48. };
  49. /* Flash helper algorithm */
  50. const uint8_t cc2538_algo[] = {
  51. 0x80, 0xb4, 0x83, 0xb0, 0x00, 0xaf, 0x03, 0x4b,
  52. 0x7b, 0x60, 0x7b, 0x68, 0x4f, 0xf0, 0xff, 0x32,
  53. 0x1a, 0x60, 0xfe, 0xe7, 0xf8, 0x1b, 0x00, 0x20,
  54. //#include "../../../contrib/loaders/flash/cc2538/cc2538_algo.inc"
  55. };
  56. #endif /* OPENOCD_FLASH_NOR_CC2538_H */