Step 7 : ARM 4.0 C Hello World example

Description

We have measured our transaction so we can now stop the application instance:

  1. To stop the application instance we use the arm_stop_application() call. We pass the following parameters:
    1. pointer to application start handle we got from the ARM agent in the previous call to arm_start_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:    return 0;
27: }