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.
 
 
 
 
 
 

74 lines
1.9 KiB

  1. /*
  2. * OpenOCD STM8 target driver
  3. * Copyright (C) 2017 Ake Rehnman
  4. * ake.rehnman(at)gmail.com
  5. *
  6. * This program is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #ifndef OPENOCD_TARGET_STM8_H
  20. #define OPENOCD_TARGET_STM8_H
  21. struct target;
  22. #define STM8_COMMON_MAGIC 0x53544D38
  23. #define STM8_NUM_CORE_REGS 6
  24. struct stm8_common {
  25. uint32_t common_magic;
  26. void *arch_info;
  27. struct reg_cache *core_cache;
  28. uint32_t core_regs[STM8_NUM_CORE_REGS];
  29. /* working area for fastdata access */
  30. struct working_area *fast_data_area;
  31. bool swim_configured;
  32. bool bp_scanned;
  33. uint8_t num_hw_bpoints;
  34. uint8_t num_hw_bpoints_avail;
  35. struct stm8_comparator *hw_break_list;
  36. uint32_t blocksize;
  37. uint32_t flashstart;
  38. uint32_t flashend;
  39. uint32_t eepromstart;
  40. uint32_t eepromend;
  41. uint32_t optionstart;
  42. uint32_t optionend;
  43. bool enable_step_irq;
  44. bool enable_stm8l;
  45. uint32_t flash_cr2;
  46. uint32_t flash_ncr2;
  47. uint32_t flash_iapsr;
  48. uint32_t flash_dukr;
  49. uint32_t flash_pukr;
  50. /* cc value used for interrupt flags restore */
  51. uint32_t cc;
  52. bool cc_valid;
  53. /* register cache to processor synchronization */
  54. int (*read_core_reg)(struct target *target, unsigned int num);
  55. int (*write_core_reg)(struct target *target, unsigned int num);
  56. };
  57. static inline struct stm8_common *
  58. target_to_stm8(struct target *target)
  59. {
  60. return target->arch_info;
  61. }
  62. #endif /* OPENOCD_TARGET_STM8_H */