X-Git-Url: https://review.openocd.org/gitweb?a=blobdiff_plain;f=src%2Frtos%2FThreadX.c;h=19dc46360220a113cf96ee8bc6cc270ef4774a54;hb=e1d2abc9ca53d983716ac9dcc481b8130d8e5ca2;hp=a9e313bf2ef44bbe1ae2c4ca6ed45c6d086e07f0;hpb=7b032df3aa63905c16c63f1ba4414a04687f3777;p=openocd.git diff --git a/src/rtos/ThreadX.c b/src/rtos/ThreadX.c index a9e313bf2e..19dc463602 100644 --- a/src/rtos/ThreadX.c +++ b/src/rtos/ThreadX.c @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * ***************************************************************************/ #ifdef HAVE_CONFIG_H @@ -28,6 +28,7 @@ #include "target/target_type.h" #include "rtos.h" #include "helper/log.h" +#include "helper/types.h" #include "rtos_standard_stackings.h" static int ThreadX_detect_rtos(struct target *target); @@ -72,14 +73,23 @@ struct ThreadX_params { const struct ThreadX_params ThreadX_params_list[] = { { - "cortex_m3", /* target_name */ + "cortex_m", /* target_name */ 4, /* pointer_width; */ 8, /* thread_stack_offset; */ 40, /* thread_name_offset; */ 48, /* thread_state_offset; */ 136, /* thread_next_offset */ &rtos_standard_Cortex_M3_stacking, /* stacking_info */ - } + }, + { + "cortex_r4", /* target_name */ + 4, /* pointer_width; */ + 8, /* thread_stack_offset; */ + 40, /* thread_name_offset; */ + 48, /* thread_state_offset; */ + 136, /* thread_next_offset */ + &rtos_standard_Cortex_R4_stacking, /* stacking_info */ + }, }; #define THREADX_NUM_PARAMS ((int)(sizeof(ThreadX_params_list)/sizeof(struct ThreadX_params))) @@ -97,8 +107,6 @@ static char *ThreadX_symbol_list[] = { NULL }; -#define THREADX_NUM_SYMBOLS (sizeof(ThreadX_symbol_list)/sizeof(char *)) - const struct rtos_type ThreadX_rtos = { .name = "ThreadX", @@ -126,12 +134,12 @@ static int ThreadX_update_threads(struct rtos *rtos) param = (const struct ThreadX_params *) rtos->rtos_specific_params; if (rtos->symbols == NULL) { - LOG_OUTPUT("No symbols for ThreadX\r\n"); + LOG_ERROR("No symbols for ThreadX"); return -4; } if (rtos->symbols[ThreadX_VAL_tx_thread_created_count].address == 0) { - LOG_OUTPUT("Don't have the number of threads in ThreadX \r\n"); + LOG_ERROR("Don't have the number of threads in ThreadX"); return -2; } @@ -142,7 +150,7 @@ static int ThreadX_update_threads(struct rtos *rtos) (uint8_t *)&thread_list_size); if (retval != ERROR_OK) { - LOG_OUTPUT("Could not read ThreadX thread count from target\r\n"); + LOG_ERROR("Could not read ThreadX thread count from target"); return retval; } @@ -174,7 +182,7 @@ static int ThreadX_update_threads(struct rtos *rtos) (uint8_t *)&rtos->current_thread); if (retval != ERROR_OK) { - LOG_OUTPUT("Could not read ThreadX current thread from target\r\n"); + LOG_ERROR("Could not read ThreadX current thread from target"); return retval; } @@ -211,7 +219,7 @@ static int ThreadX_update_threads(struct rtos *rtos) param->pointer_width, (uint8_t *)&thread_ptr); if (retval != ERROR_OK) { - LOG_OUTPUT("Could not read ThreadX thread location from target\r\n"); + LOG_ERROR("Could not read ThreadX thread location from target"); return retval; } @@ -233,7 +241,7 @@ static int ThreadX_update_threads(struct rtos *rtos) param->pointer_width, (uint8_t *)&name_ptr); if (retval != ERROR_OK) { - LOG_OUTPUT("Could not read ThreadX thread name pointer from target\r\n"); + LOG_ERROR("Could not read ThreadX thread name pointer from target"); return retval; } @@ -244,7 +252,7 @@ static int ThreadX_update_threads(struct rtos *rtos) THREADX_THREAD_NAME_STR_SIZE, (uint8_t *)&tmp_str); if (retval != ERROR_OK) { - LOG_OUTPUT("Error reading thread name from ThreadX target\r\n"); + LOG_ERROR("Error reading thread name from ThreadX target"); return retval; } tmp_str[THREADX_THREAD_NAME_STR_SIZE-1] = '\x00'; @@ -263,7 +271,7 @@ static int ThreadX_update_threads(struct rtos *rtos) 4, (uint8_t *)&thread_status); if (retval != ERROR_OK) { - LOG_OUTPUT("Error reading thread state from ThreadX target\r\n"); + LOG_ERROR("Error reading thread state from ThreadX target"); return retval; } @@ -296,7 +304,7 @@ static int ThreadX_update_threads(struct rtos *rtos) param->pointer_width, (uint8_t *) &thread_ptr); if (retval != ERROR_OK) { - LOG_OUTPUT("Error reading next thread pointer in ThreadX thread list\r\n"); + LOG_ERROR("Error reading next thread pointer in ThreadX thread list"); return retval; } } @@ -331,7 +339,7 @@ static int ThreadX_get_thread_reg_list(struct rtos *rtos, int64_t thread_id, cha param->pointer_width, (uint8_t *)&stack_ptr); if (retval != ERROR_OK) { - LOG_OUTPUT("Error reading stack frame from ThreadX thread\r\n"); + LOG_ERROR("Error reading stack frame from ThreadX thread"); return retval; } @@ -342,9 +350,9 @@ static int ThreadX_get_symbol_list_to_lookup(symbol_table_elem_t *symbol_list[]) { unsigned int i; *symbol_list = (symbol_table_elem_t *) malloc( - sizeof(symbol_table_elem_t) * THREADX_NUM_SYMBOLS); + sizeof(symbol_table_elem_t) * ARRAY_SIZE(ThreadX_symbol_list)); - for (i = 0; i < THREADX_NUM_SYMBOLS; i++) + for (i = 0; i < ARRAY_SIZE(ThreadX_symbol_list); i++) (*symbol_list)[i].symbol_name = ThreadX_symbol_list[i]; return 0; @@ -391,7 +399,7 @@ static int ThreadX_get_thread_detail(struct rtos *rtos, param = (const struct ThreadX_params *) rtos->rtos_specific_params; if (rtos->symbols == NULL) { - LOG_OUTPUT("No symbols for ThreadX\r\n"); + LOG_ERROR("No symbols for ThreadX"); return -3; } @@ -404,7 +412,7 @@ static int ThreadX_get_thread_detail(struct rtos *rtos, param->pointer_width, (uint8_t *)&name_ptr); if (retval != ERROR_OK) { - LOG_OUTPUT("Could not read ThreadX thread name pointer from target\r\n"); + LOG_ERROR("Could not read ThreadX thread name pointer from target"); return retval; } @@ -414,7 +422,7 @@ static int ThreadX_get_thread_detail(struct rtos *rtos, THREADX_THREAD_NAME_STR_SIZE, (uint8_t *)&tmp_str); if (retval != ERROR_OK) { - LOG_OUTPUT("Error reading thread name from ThreadX target\r\n"); + LOG_ERROR("Error reading thread name from ThreadX target"); return retval; } tmp_str[THREADX_THREAD_NAME_STR_SIZE-1] = '\x00'; @@ -432,7 +440,7 @@ static int ThreadX_get_thread_detail(struct rtos *rtos, 4, (uint8_t *)&thread_status); if (retval != ERROR_OK) { - LOG_OUTPUT("Error reading thread state from ThreadX target\r\n"); + LOG_ERROR("Error reading thread state from ThreadX target"); return retval; } @@ -466,7 +474,7 @@ static int ThreadX_create(struct target *target) i++; } if (i >= THREADX_NUM_PARAMS) { - LOG_OUTPUT("Could not find target in ThreadX compatibility list\r\n"); + LOG_ERROR("Could not find target in ThreadX compatibility list"); return -1; }