Embedded Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsComputer HardwareEmbedded Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 9th, 2012, 11:15 PM
KansaiRobot KansaiRobot is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2012
Posts: 18 KansaiRobot User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 17 m 30 sec
Reputation Power: 0
Startup Code

Well, the last time I touched assembly was when I was in college and just a little for a 8086 processor as far as I remember..

Anyway, many years later I have been asked to touch again assembly code for a SuperH processor.

I ve reading books to refresh my assembly and to understand the code that I have been handed and all is fine but I have a question on startup codes. In other words what happens when I turn on the processor?

That is something that in all my years programming I have never even thought about...I always assumed everything started at the main() function!

Then I received a code in C and assembly that doesnt even have a main function!

In the books I am reading they talk about memory, exceptions, devices etc, but they barely mention this

what happens when I turn on the processor?

Michael Barr in his book "Programmin Embedded Systems in C++" mentions that (pag 62) you go from reset: to hw_init: (hardware initialization) to startup and then to main()

Do any of you guys have a good resource, or examples in which I can learn about this?

Sorry for the long post , your help will be appreciated!

Reply With Quote
  #2  
Old April 10th, 2012, 10:34 PM
E-Oreo's Avatar
E-Oreo E-Oreo is offline
Lost in code
Dev Shed God 7th Plane (8000 - 8499 posts)
 
Join Date: Dec 2004
Posts: 8,057 E-Oreo User rank is General 92nd Grade (Above 100000 Reputation Level)E-Oreo User rank is General 92nd Grade (Above 100000 Reputation Level)E-Oreo User rank is General 92nd Grade (Above 100000 Reputation Level)E-Oreo User rank is General 92nd Grade (Above 100000 Reputation Level)E-Oreo User rank is General 92nd Grade (Above 100000 Reputation Level)E-Oreo User rank is General 92nd Grade (Above 100000 Reputation Level)E-Oreo User rank is General 92nd Grade (Above 100000 Reputation Level)E-Oreo User rank is General 92nd Grade (Above 100000 Reputation Level)E-Oreo User rank is General 92nd Grade (Above 100000 Reputation Level)E-Oreo User rank is General 92nd Grade (Above 100000 Reputation Level)E-Oreo User rank is General 92nd Grade (Above 100000 Reputation Level)E-Oreo User rank is General 92nd Grade (Above 100000 Reputation Level)E-Oreo User rank is General 92nd Grade (Above 100000 Reputation Level)E-Oreo User rank is General 92nd Grade (Above 100000 Reputation Level)E-Oreo User rank is General 92nd Grade (Above 100000 Reputation Level)E-Oreo User rank is General 92nd Grade (Above 100000 Reputation Level)  Folding Points: 945 Folding Title: Novice Folder
Time spent in forums: 2 Months 1 Day 6 h 47 sec
Reputation Power: 7104
When you turn on the processor it begins executing code from a memory location that's permanently built into the hardware. Generally this memory location is ROM containing a BIOS, but I don't know anything specifically about the SuperH processor; it might just start executing from the first block of program memory.

If you just received a chunk of assembly code it's likely that the code starts executing at the beginning. The main() method only has significance because when the C compiler is compiling your C code it puts the code from the main() method into the memory location that is executed first.

Depending on what compiler you're using, it's possible that they have a different name for the "main" method. Or perhaps the assembly code you received is where the program starts and the C files are just used by that assembly code.
__________________
PHP FAQ
How to program a basic, secure login system using PHP
Connect with me on LinkedIn


Quote:
Originally Posted by Spad
Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around

Reply With Quote
Reply

Viewing: Dev Shed ForumsComputer HardwareEmbedded Programming > Startup Code

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap