faq's
    • as the memory model goes from small to large, the size of pointers to functions changes from 2 bytes to 3 bytes.
      please note that when using an array of pointers to functions.
      the sizeof operation result for a single pointer to a function in the large model is 3, but in the case of an array of pointers to functions, a 1-byte padding is inserted after each element.
      so with 5 elements, the size of the array is
      ((pointer size 3 bytes) (padding 1 byte)) * (number of elements 5) = 20 bytes.
      for details, see "1.5.2.2 arrays other than char type" in "ccu8 programming guide".

      also, when calculating the number of elements in an array, it is generally calculated by dividing the size of the entire array by the size of the elements in the array.
      therefore, the following macro may be defined as a macro for calculating the number of array elements.
      #define arr_num(array) (sizeof(array)/sizeof(array[0]))
      if the pointer size is 3 bytes, the total array size includes 1 byte padding for each element, so the number of elements is calculated incorrectly. in this case, you need to change it as follows.
      #define arr_num(array) (sizeof(array)/(sizeof(array[0]) == 3 ? 4 : sizeof(array[0])))
    • products: microcontrollers (mcus)