Step 8 : ARM 4.0 C Hello World example

Description

The only thing left to do is to inform ARM that we are done with it:

  1. We destroy all previously registered meta data by calling the arm_destroy_application() call. We pass the following parameters:
    1. pointer to application ID we got from the ARM agent in the previous call to arm_register_application().
    2. ARM_FLAG_NONE - there are no flags defined for this API call.
    3. ARM_BUF4_NONE - it is a simple example, so no optional data is passed.

Code

01: #include <stdio.h>
02: #include "arm4.h"
03: 
04: int main(int argc, char *argv[])
05: {   
06:    arm_id_t app_id;
07:    arm_id_t tran_id;
08:    arm_app_start_handle_t app_handle;
09:    arm_tran_start_handle_t tran_handle;
10:    arm_register_application("HelloWorldApp", ARM_ID_NONE,
11:                              ARM_FLAG_NONE, ARM_BUF4_NONE,
12:                              &app_id);
13:    arm_register_transaction(&app_id, "HelloWorldTran", ARM_ID_NONE,
14:                              ARM_FLAG_NONE, ARM_BUF4_NONE,
15:                              &tran_id);
16:    arm_start_application(&app_id, "Tutorial", NULL,
17:                           ARM_FLAG_NONE, ARM_BUF4_NONE,
18:                           &app_handle);
19:    arm_start_transaction(app_handle, &tran_id, ARM_CORR_NONE,
20:                           ARM_FLAG_NONE, ARM_BUF4_NONE,
21:                           &tran_handle, ARM_CORR_NONE);
22:    printf("Hello world!\n");
23:    arm_stop_transaction(tran_handle, ARM_STATUS_GOOD, 
24:                          ARM_FLAG_NONE, ARM_BUF4_NONE);
25:    arm_stop_application(app_handle, ARM_FLAG_NONE, ARM_BUF4_NONE);
26:    arm_destroy_application(&app_id, ARM_FLAG_NONE, ARM_BUF4_NONE);
27:    return 0;
28: }