Missing Symbols in Firmware?

Moderators: lily.li, violet, jessie, chao.zhang

blkhawk
Pre-kindergarten
Pre-kindergarten
Posts: 9
Joined: Tue Dec 29, 2015 11:38 pm

Missing Symbols in Firmware?

Post by blkhawk » Wed Jan 06, 2016 3:40 am

Hi,

I have been trying to use various of the api calls that are defined in the headers but are not directly exposed as part of the arduino ide - I noticed that a lot of the most interesting ones for me seem to be missing from the firmware.

I plan to use the ones that control the power management to check the battery level and trigger the power-off and restart calls. kaktus.martin over in the SIM-Card thread also found non-included APIs regarding Sim Management.

Is this a problem of the firmware that is used with the Arduino ide? Would switching to the eclipse IDE and the alternative SDK help?

Being able to check the battery level and schedule Wake-ups by time would really help with my project (I would have to externalize that to a second micro otherwise).

bakhdaulet
Pre-kindergarten
Pre-kindergarten
Posts: 13
Joined: Tue Dec 29, 2015 11:58 am

Re: Missing Symbols in Firmware?

Post by bakhdaulet » Thu Jan 07, 2016 2:30 pm

blkhawk wrote:Hi,

I have been trying to use various of the api calls that are defined in the headers but are not directly exposed as part of the arduino ide - I noticed that a lot of the most interesting ones for me seem to be missing from the firmware.

I plan to use the ones that control the power management to check the battery level and trigger the power-off and restart calls. kaktus.martin over in the SIM-Card thread also found non-included APIs regarding Sim Management.

Is this a problem of the firmware that is used with the Arduino ide? Would switching to the eclipse IDE and the alternative SDK help?

Being able to check the battery level and schedule Wake-ups by time would really help with my project (I would have to externalize that to a second micro otherwise).
Hi,
You can use native APIs on IDE Eclipse for Xadow GSM (2502 SDK 2.0.46),
Power Management http://labs.mediatek.com/site/global/de ... _POWER.gsp
GSM Management
http://labs.mediatek.com/site/global/de ... /C_GSM.gsp

blkhawk
Pre-kindergarten
Pre-kindergarten
Posts: 9
Joined: Tue Dec 29, 2015 11:38 pm

Re: Missing Symbols in Firmware?

Post by blkhawk » Thu Jan 07, 2016 3:39 pm

So you tried it? I am asking because the headers are there in the arduino ide as well - calls to "vm_pwr_get_battery_level" just return -103 and "vm_pwr_shutdown" or "vm_pwr_reboot" for instance do nothing (I would expect that the module goes off or restarts) - I am asking because I have some Problems with getting the SDK to work correctly with my ecipse setup and i will have to probably reinstall the IDE or do even more.

blkhawk
Pre-kindergarten
Pre-kindergarten
Posts: 9
Joined: Tue Dec 29, 2015 11:38 pm

Re: Missing Symbols in Firmware?

Post by blkhawk » Fri Jan 08, 2016 1:32 am

So I tried it after getting Home from work - seems like the Arduino firmware misses a lot of symbols - probably those that haven't been directly implemented.
Using the eclipse IDE with the SDK however allows me to access those API calls.

kaktus.martin
Pre-kindergarten
Pre-kindergarten
Posts: 13
Joined: Tue Dec 29, 2015 9:33 pm

Re: Missing Symbols in Firmware?

Post by kaktus.martin » Fri Jan 08, 2016 3:21 am

blkhawk wrote:So I tried it after getting Home from work - seems like the Arduino firmware misses a lot of symbols - probably those that haven't been directly implemented.
Using the eclipse IDE with the SDK however allows me to access those API calls.
Tried the functions with with Eclipse und the SDK 2.0.46, the reboot function has no effect an I get the return value "-103" from the vm_pwr_get_battery_level() function also...

blkhawk
Pre-kindergarten
Pre-kindergarten
Posts: 9
Joined: Tue Dec 29, 2015 11:38 pm

Re: Missing Symbols in Firmware?

Post by blkhawk » Fri Jan 08, 2016 4:16 am

Both shutdown and reboot work fine here. I used the unmodified demo code for testing - did you flash the SDK version of the firmware with the Firmware updater? Its different from the one with the arduino ide.

kaktus.martin
Pre-kindergarten
Pre-kindergarten
Posts: 13
Joined: Tue Dec 29, 2015 9:33 pm

Re: Missing Symbols in Firmware?

Post by kaktus.martin » Fri Jan 08, 2016 5:09 am

blkhawk wrote:Both shutdown and reboot work fine here. I used the unmodified demo code for testing - did you flash the SDK version of the firmware with the Firmware updater? Its different from the one with the arduino ide.
I Think I figured something out, here is my example code:

Code: Select all

#include "vmsystem.h"
#include "vmthread.h"
#include "ResID.h"
#include "vmpwr.h"
#include "vmlog.h"

#include "vmgsm_sim.h"

VM_THREAD_HANDLE main_handle;

VMINT32 main_thread(VM_THREAD_HANDLE thread_handle, void *user_data)
{
	vm_thread_sleep(2000);

	vm_log_debug("Value: %i, %i",  vm_gsm_sim_has_card(), vm_pwr_get_battery_level());
	while(1)
	{
		vm_thread_sleep(1000);
	}

	return 0;
}

void handle_system_event(VMINT message, VMINT param)
{
	switch (message)
	{
		case VM_EVENT_CREATE:
			vm_log_debug("Value: %i, %i",  vm_gsm_sim_has_card(), vm_pwr_get_battery_level());
			main_handle = vm_thread_create(main_thread, NULL, 200);
	        break;
		case VM_EVENT_QUIT:
	        break;
	}
}

void vm_main(void)
{
	vm_pmng_register_system_event_callback(handle_system_event);
}
So the debug output of the example is in line 29 "Value: 1,100" and in line 15 "Value: 1,100".
But if I comment out the debug output in line 29 the debug output of line 15 will be: "Value: 0, -103"....

Its little bit strange!?!??!
Last edited by kaktus.martin on Sat Jan 09, 2016 10:18 am, edited 1 time in total.

bakhdaulet
Pre-kindergarten
Pre-kindergarten
Posts: 13
Joined: Tue Dec 29, 2015 11:58 am

Re: Missing Symbols in Firmware?

Post by bakhdaulet » Fri Jan 08, 2016 2:29 pm

Code: Select all

#include "vmsystem.h"
#include "vmtype.h"
#include "vmlog.h"
#include "vmtimer.h"
#include "ResID.h"
#include "hello-world.h"
#include "vmpwr.h"


VM_TIMER_ID_PRECISE sys_timer_id = 0;

void sys_timer_callback(VM_TIMER_ID_PRECISE sys_timer_id, void* user_data)
{
    VMINT bat_level;
    bat_level=vm_pwr_get_battery_level();
	vm_log_info("уровень батареи: =%d,%d",bat_level,vm_pwr_is_charging());

}

void handle_sysevt(VMINT message, VMINT param)
{
    switch (message)
    {
        case VM_EVENT_CREATE:
        sys_timer_id = vm_timer_create_non_precise(1000, sys_timer_callback, NULL);
        break;
        case VM_EVENT_PAINT:
        break;
        case VM_EVENT_QUIT:
        break;
    }
}

void vm_main(void)
{
    vm_pmng_register_system_event_callback(handle_sysevt);
}
Use this code

kaktus.martin
Pre-kindergarten
Pre-kindergarten
Posts: 13
Joined: Tue Dec 29, 2015 9:33 pm

Re: Missing Symbols in Firmware?

Post by kaktus.martin » Sat Jan 09, 2016 10:17 am

bakhdaulet wrote:Use this code
I don't wan't to use a timer function, my question ist why the function can't be called out of a thread?!?

bakhdaulet
Pre-kindergarten
Pre-kindergarten
Posts: 13
Joined: Tue Dec 29, 2015 11:58 am

Re: Missing Symbols in Firmware?

Post by bakhdaulet » Sat Jan 09, 2016 3:18 pm

kaktus.martin wrote:
I don't wan't to use a timer function, my question ist why the function can't be called out of a thread?!?
Read documentation http://labs.mediatek.com/fileMedia/down ... 6aad86ea67

4.4. Threads
As described in 2.1”Environment”, the application is executed in a multi-threaded environment
and the application itself runs in the main thread, and most APIs are only available to the main
thread
. The application can create and control a limited number of new threads with the
vm_thread function. Basic inter-thread communication message mechanisms and
synchronization mechanisms are also provided. Refer to 5.5.5, “Threads” for details.

Post Reply