Calling functions from the debugger

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Calling functions from the debugger

ソリューションへジャンプ
2,130件の閲覧回数
etolocka
Contributor I
Hi

Can I run a function of my source code from within the debugger?

Suppose I have a function called "Bip" to make a sound with a buzzer. With the code loaded in the target and the simulator halted, can I call this function to test how it works?

I tried to add it to the Data Objetc window, as an expression, but does not work?

Any advice about this?

Thankfully,
Ernesto.



Message Edited by etolocka on 2008-01-23 05:58 PM
ラベル(1)
タグ(1)
0 件の賞賛
返信
1 解決策
1,368件の閲覧回数
J2MEJediMaster
Specialist I
You need to specify the target MCU and CodeWarrior version to get a correct answer. I'll give it a shot anyway, assuming a HCSX MCU.

Once you've downloaded the code, you're staring at the True-Time Simulator window. Locate the function you want to execute by choosing Source | Find Procedure... and then enter your function name. Click OK, and you'll land at the first executable source line your function. Now right-click in the source window and choose Set Program Counter from the drop-down menu. Now you can single-step or execute the function's code from this point. However, keep in mind that you've just by-passed a lot of initialization code that sets up the peripheral for output and configures its features. So, you may not get the results that you expect.

You can work around the initialization problem if your program isn't using an OS. Go to the project's Debugger Settings panel (type Alt-F7 in the CW IDE to get there) and in the Stop on application launch section, click on the User Specfied button and enter main() into the text entry box. Now when the program loads, the simulator starts and executes all functions (which most likely handle the device setup) up until main(). Now readjust the program counter and try executing the function. Still no guarantee that some key bit of initialization code has been overlooked, but it's worth a try.

---Tom

元の投稿で解決策を見る

0 件の賞賛
返信
1 返信
1,369件の閲覧回数
J2MEJediMaster
Specialist I
You need to specify the target MCU and CodeWarrior version to get a correct answer. I'll give it a shot anyway, assuming a HCSX MCU.

Once you've downloaded the code, you're staring at the True-Time Simulator window. Locate the function you want to execute by choosing Source | Find Procedure... and then enter your function name. Click OK, and you'll land at the first executable source line your function. Now right-click in the source window and choose Set Program Counter from the drop-down menu. Now you can single-step or execute the function's code from this point. However, keep in mind that you've just by-passed a lot of initialization code that sets up the peripheral for output and configures its features. So, you may not get the results that you expect.

You can work around the initialization problem if your program isn't using an OS. Go to the project's Debugger Settings panel (type Alt-F7 in the CW IDE to get there) and in the Stop on application launch section, click on the User Specfied button and enter main() into the text entry box. Now when the program loads, the simulator starts and executes all functions (which most likely handle the device setup) up until main(). Now readjust the program counter and try executing the function. Still no guarantee that some key bit of initialization code has been overlooked, but it's worth a try.

---Tom
0 件の賞賛
返信