Barack Obama toured a U.S.-supported food factory in Ethiopia on Tuesday on the last leg of an Africa trip, before winding up his visit at the African Union where he will become the first U.S. president to address the 54-nation body.

Obama has used his trip to Kenya, his father's homeland, and Ethiopia to discuss security cooperation with states battling Islamist militants in Somalia, democracy and trade with a continent boasting some of the world's fastest growing economies.

But one of his main themes throughout has been that Africa and its nations can aspire to a bigger role in the global economy, and the United States was ready to be a partner with a continent where China now does more trade than America.

"This continent needs to be a future hub of global growth, not just African growth," he told African entrepreneurs at the start of his trip.

Ethiopia, once stricken by famine, has turned its economy around and, this year, is on course to deliver growth of about 10 percent. After talks with Prime Minister Hailemariam Desalegn on Monday, he visited Ethiopia's Faffa Food factory on Tuesday.

"We want Ethiopia not only to be able to feed itself, we want eventually Ethiopia to be a food exporter as well," Obama said at the factory.

The company produces fortified foods for Ethiopia and sells some products to the U.N. World Food Programme to support the needy in other nations. The firm is backed by the U.S. government's Feed the Future initiative.

While in Ethiopia, Obama held talks with regional African leaders on the conflict in South Sudan. The U.S. president called for tougher measures against the world's newest nation if its warring factions failed to reach a peace deal by Aug. 17.

At the African Union headquarters in Addis Ababa, there will be other challenges to address, such as the Ebola epidemic in West Africa, the Islamist group Boko Haram's violent campaign in Nigeria and elections in Burundi that Washington says were not credible.

But he can also applaud the gradual transformation of a continent, which once used to hit the headlines because of coups, wars and starvation, but is now increasingly courted by investors. On Monday, he highlighted that change in Ethiopia.

"To many people around the world, their image of Ethiopia remains stuck in the past -- remembering drought and famine," he said. "But in the past 15 years, Ethiopia has lifted millions of people out of poverty."

Despite such achievements, Ethiopia's ruling party has faced accusations that it stifles political freedoms and detains journalists and bloggers for speaking out, charges it denies.

Obama called for Ethiopia to open up but his reference to "a democratically elected government" drew criticism from rights groups and opponents, who pointed to a parliamentary election in May in which the opposition won no seats.